Skip to content

Add native Google Sheets tools to repo agent#1481

Merged
Evanfeenstra merged 1 commit into
mainfrom
google-sheets-tools
Jul 23, 2026
Merged

Add native Google Sheets tools to repo agent#1481
Evanfeenstra merged 1 commit into
mainfrom
google-sheets-tools

Conversation

@Evanfeenstra

Copy link
Copy Markdown
Collaborator

What

Adds a native sheets_* tool family to repo/agent so agents can create Google Spreadsheets, build calculations with live formulas, and read computed results back:

  • sheets_create_spreadsheet — creates via the Drive API inside the configured folder/shared drive (supportsAllDrives), so agent-created sheets are immediately visible to humans; supports extra tabs up front
  • sheets_update_values / sheets_batch_update_valuesUSER_ENTERED writes, so strings starting with = become live formulas
  • sheets_get_valuesrender: computed | formatted | formula for reading results or auditing formulas
  • sheets_add_sheet — add a tab to an existing spreadsheet

How it's triggered

Mirrors the stakwork tools pattern: the family registers only when the caller supplies service-account credentials on the request body — never an LLM-visible parameter, never persisted to session config:

{
  "prompt": "build a mortgage comparison sheet with live formulas",
  "googleSheets": {
    "serviceAccount": { ...service account JSON (object, JSON string, or base64)... },
    "driveFolderId": "<shared folder or shared drive id>"
  }
}

toolsConfig can disable individual tools ("sheets_add_sheet": false) or override descriptions, same as everywhere else.

Implementation notes

  • No new dependencies: auth is a plain service-account JWT flow (RS256 assertion via the existing jsonwebtoken, exchanged at token_uri), then straight REST calls with axios. Access token cached per agent run only, so different callers' credentials never mix.
  • Handles the common credential paste bugs: object / JSON string / base64 input, literal \n in private keys.
  • API failures and bad credentials return non-fatal "...failed: ..." strings to the agent.

Testing

  • 10 unit tests (credential parsing, registration gating, per-tool overrides, graceful execute failure); full test:node suite passes (181 tests)
  • Verified end-to-end against the real Google API: agent created a spreadsheet in a shared drive, wrote A1=2, A2=3, A3==A1+A2, and read back the computed 5

🤖 Generated with Claude Code

…d service account

New sheets_* tool family (create_spreadsheet, update_values,
batch_update_values, get_values, add_sheet) implemented directly against
the Google Sheets + Drive REST APIs — no MCP server or googleapis
dependency; auth is a service-account JWT flow via the existing
jsonwebtoken package, with the access token cached per agent run.

Registration mirrors the stakwork tools: credentials arrive on the
request body (googleSheets.serviceAccount + optional driveFolderId),
are never LLM-visible, and are not persisted to session config.
toolsConfig can disable individual tools or override descriptions.

Spreadsheets are created through the Drive API inside driveFolderId
(shared folder or shared drive) so agent-created sheets are visible to
humans; tool descriptions steer the agent toward live USER_ENTERED
formulas read back with sheets_get_values render options.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Evanfeenstra
Evanfeenstra merged commit 1f9b0c4 into main Jul 23, 2026
6 checks passed
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.

1 participant