Skip to content

feat: add modifyText and findAndReplace tools#94

Merged
a-bonus merged 1 commit intoa-bonus:mainfrom
Mawox:feat/modify-text-find-replace
Mar 23, 2026
Merged

feat: add modifyText and findAndReplace tools#94
a-bonus merged 1 commit intoa-bonus:mainfrom
Mawox:feat/modify-text-find-replace

Conversation

@Mawox
Copy link
Copy Markdown

@Mawox Mawox commented Mar 23, 2026

Summary

  • modifyText: Combines text replacement/insertion and formatting in one atomic batchUpdate call. Supports insert, replace, format-only, and combined modes with text-search or index-based targeting. This is the key missing feature vs competing MCP servers (e.g. taylorwilsdon/google_workspace_mcp's modify_doc_text).
  • findAndReplace: Wraps the native replaceAllText API request with tab-scoping support via tabsCriteria. Replaces all occurrences of a string throughout a document or specific tab.

Files changed (5 files, 575 lines)

File Description
src/tools/docs/modifyText.ts New tool: combined text modification + formatting
src/tools/docs/findAndReplace.ts New tool: global find-and-replace
src/tools/docs/index.ts Registration of both new tools
src/tools/docs/modifyText.test.ts 10 unit tests for buildModifyTextRequests
src/tools/docs/findAndReplace.test.ts 6 tests with mocked API client

Test plan

  • npm run build -- compiles cleanly
  • npm test -- all 140 tests pass (16 new + 124 existing)
  • npm run format -- Prettier applied
  • modifyText: insert mode, replace mode, format-only, replace+format, insert+format, tabId propagation
  • findAndReplace: basic replacement, matchCase, empty replace (deletion), tabsCriteria shape, null occurrencesChanged handling

modifyText combines text replacement/insertion and formatting in one atomic batchUpdate call. Supports insert, replace, format-only, and combined modes with text-search or index-based targeting.

findAndReplace wraps the native replaceAllText API request with tab-scoping support via tabsCriteria.

Both tools include comprehensive Vitest test suites.

Made-with: Cursor
@a-bonus a-bonus merged commit b4fac35 into a-bonus:main Mar 23, 2026
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.

2 participants