Fix #97: Bug: Google Drive MCP server not connected — no Drive tools available at runtime#99
Open
treehouse-squirrel wants to merge 1 commit into
Open
Fix #97: Bug: Google Drive MCP server not connected — no Drive tools available at runtime#99treehouse-squirrel wants to merge 1 commit into
treehouse-squirrel wants to merge 1 commit into
Conversation
Four related problems addressed: 1. docker-entrypoint.sh: if GOOGLE_CREDENTIALS is set but the gdrive proxy fails to become healthy in 30s, the container previously crashed (exit 1). Now it kills the proxy process, unsets GDRIVE_MCP_PROXY_URL, and continues — the bot starts degraded (no Drive tools) rather than being completely unavailable. 2. prompt.ts (defaultSystemPrompt): the system prompt always claimed Google Drive was available regardless of whether the proxy was running. It now checks GDRIVE_MCP_PROXY_URL at call time so the bot is only told it has Drive access when the connection is actually live. The "search Google Drive first" guideline is likewise gated. 3. user-docs.ts: the user-facing guide still said Squirrel "cannot write to Google Drive" — a stale line left over before the write tools were added in #83. Removed that incorrect statement and added "Create and write documents" to the can-do section. 4. Tests: updated agent.test.ts to clean up GDRIVE_MCP_PROXY_URL after the MCP-server inclusion test and added a matching test that asserts gdrive is absent when the env var is unset. Updated prompt.test.ts to split the old "mentions key data sources" assertion into three targeted tests covering the conditional gdrive behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #97.
What changed and why
Issue #97 reported that the Google Drive MCP server is completely absent from the running Squirrel instance — not even as deferred tools. Four code-level problems were contributing and are fixed here:
1. Entrypoint crashes the whole container when the gdrive proxy fails (
docker-entrypoint.sh)Previously: if
GOOGLE_CREDENTIALSwas set but the gdrive proxy didn't become healthy within 30 s, the script ranexit 1— crashing the container. ECS would roll back to a previous revision, potentially one that also couldn't start the proxy, leaving the bot in a degraded loop with no Drive tools.Now: on timeout the script kills the proxy process, unsets
GDRIVE_MCP_PROXY_URL, and continues. The agent starts without Google Drive tools rather than being completely unavailable.2. System prompt always claimed Google Drive was available (
prompt.ts)defaultSystemPrompt()unconditionally listed Google Drive as an available tool and instructed the bot to "always search Google Drive first". WhenGDRIVE_MCP_PROXY_URLis not set (either because credentials are missing or because the proxy failed), the bot would be told it has Drive access while the tools didn't exist — leading to confusion and incorrect responses.Now: both the Drive tool line and the "search Drive first" guideline are gated on
!!process.env.GDRIVE_MCP_PROXY_URL. The bot's self-description matches reality.3. User guide said "cannot write to Google Drive" (
user-docs.ts)This was stale copy left over before the write tools were added in #83. The user guide now lists "Create and write documents" in the can-do section and drops the incorrect cannot-do entry.
4. Test cleanup and coverage (
agent.test.ts,prompt.test.ts)agent.test.ts: addedtry/finallyto clean upGDRIVE_MCP_PROXY_URLandGITHUB_TOKENafter the MCP-server inclusion test; added a new test asserting gdrive is absent frommcpServerswhen the env var is unset.prompt.test.ts: split the generic "mentions key data sources" assertion into three targeted tests: one confirming GitHub/URL Fetcher appear regardless of gdrive config, one confirming Google Drive appears whenGDRIVE_MCP_PROXY_URLis set, and one confirming it is absent when the env var is unset.Operator action still required
This PR prevents the container from crashing when credentials are invalid and makes the bot honest about its capabilities when Drive is unavailable. However, for Google Drive tools to actually appear at runtime,
GOOGLE_CREDENTIALS(a single-line service-account JSON string) must be configured in the ECS task definition for the running environment. Seedocs/configuration.mdfor details.