Skip to content

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
mainfrom
claude/issue-97
Open

Fix #97: Bug: Google Drive MCP server not connected — no Drive tools available at runtime#99
treehouse-squirrel wants to merge 1 commit into
mainfrom
claude/issue-97

Conversation

@treehouse-squirrel

Copy link
Copy Markdown
Collaborator

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_CREDENTIALS was set but the gdrive proxy didn't become healthy within 30 s, the script ran exit 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". When GDRIVE_MCP_PROXY_URL is 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: added try/finally to clean up GDRIVE_MCP_PROXY_URL and GITHUB_TOKEN after the MCP-server inclusion test; added a new test asserting gdrive is absent from mcpServers when 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 when GDRIVE_MCP_PROXY_URL is 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. See docs/configuration.md for details.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Google Drive MCP server not connected — no Drive tools available at runtime

1 participant