Skip to content

feat: Multi-Tab Document Support with Read/Write Operations#23

Merged
a-bonus merged 3 commits intomainfrom
claude/review-pull-request-011CUbqzZgnEkrPeT6mgoGzm
Oct 29, 2025
Merged

feat: Multi-Tab Document Support with Read/Write Operations#23
a-bonus merged 3 commits intomainfrom
claude/review-pull-request-011CUbqzZgnEkrPeT6mgoGzm

Conversation

@a-bonus
Copy link
Copy Markdown
Owner

@a-bonus a-bonus commented Oct 29, 2025

Multi-Tab Document Support

Summary

This PR extends the previous tab support work (PR #22) with comprehensive multi-tab document functionality, including full read/write support and enhanced type safety.

Features Added

New Tool

  • listDocumentTabs - Lists all tabs in a document with hierarchy, IDs, titles, positions, and optional content summaries

Enhanced Tools (with tabId parameter)

  • readGoogleDoc - Now supports reading from specific tabs via optional tabId parameter
  • appendToGoogleDoc - Can append to specific tabs without affecting others
  • insertText - Can insert text into specific tabs
  • deleteRange - Can delete content from specific tabs in isolation

Implementation Details

  • Added tab management helpers in googleDocsApiHelpers.ts:
    • getAllTabs() - Recursively collect all tabs with hierarchy information
    • findTabById() - Locate specific tabs by ID
    • TabWithLevel interface for hierarchy tracking
  • Enhanced type safety with proper TypeScript interfaces
  • Full backward compatibility - operations without tabId default to first tab
  • Robust error handling for invalid tab IDs

Testing Status

All Tests Passed

Comprehensive testing verified:

  • ✅ Tab listing with hierarchy and content summaries
  • ✅ Reading from specific tabs (text, JSON, markdown formats)
  • ✅ Writing operations (append, insert, delete) to specific tabs
  • ✅ Tab isolation (operations don't affect other tabs)
  • ✅ Error handling for invalid tab IDs
  • ✅ Backward compatibility with single-tab and legacy documents
  • ✅ Multi-tab sequential operations work independently

Files Modified

  • src/server.ts - Added tab support to tools and new listDocumentTabs tool
  • src/googleDocsApiHelpers.ts - Added tab management helper functions
  • README.md - Added comprehensive documentation for tab features and testing section

Breaking Changes

None - All changes are fully backward compatible.

Related

Extends and completes work from PR #22.

claude and others added 3 commits October 29, 2025 17:14
…fety

This commit extends the initial tabs support from PR #22 with the following improvements:

**Core Enhancements:**
- Add tabId support to write operations (appendToGoogleDoc, insertText, deleteRange)
- Improve type safety by replacing 'any' types with proper TypeScript interfaces
- Create TabWithLevel interface for better type checking
- Fix getTabTextLength to handle tables in addition to paragraphs

**Documentation:**
- Add comprehensive tabs documentation to README.md
- Include usage examples for tab operations
- Document which tools support the tabId parameter

**Technical Improvements:**
- Use proper docs_v1.Schema$Tab and docs_v1.Schema$DocumentTab types
- Add tab validation in write operations
- Improve error messages for tab-related operations
- Maintain backward compatibility for documents without tabs

This builds upon the foundational work in PR #22, completing the tabs feature
by adding full read/write support with robust type safety.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Chris Alfano <chris@jarv.us>
This commit enhances the README.md by adding a new section on testing for the multi-tab support features. It includes:

- A list of tested features related to tab operations, such as `listDocumentTabs`, `readGoogleDoc`, `appendToGoogleDoc`, `insertText`, and `deleteRange`.
- Confirmation of tab isolation, proper validation, and backward compatibility with single-tab documents.
- Troubleshooting tips for tab-related errors.

This documentation update ensures users are informed about the functionality and reliability of the new tab features introduced in previous commits.
This commit updates the README.md to include new features and improvements related to the Google Docs MCP server. Key additions include:

- Enhanced documentation for multi-tab support, including usage examples for reading and writing to specific tabs.
- New sections for comment management and Google Drive file management, detailing tools like `listComments`, `addComment`, and document discovery features.
- Clarifications on parameters and examples for image insertion tools, including `insertImageFromUrl` and `insertLocalImage`.
- General formatting improvements and additional notes on advanced usage scenarios.

These updates ensure users have comprehensive guidance on utilizing the latest functionalities introduced in recent commits.
@a-bonus a-bonus merged commit 4437f3e into main Oct 29, 2025
@a-bonus a-bonus deleted the claude/review-pull-request-011CUbqzZgnEkrPeT6mgoGzm branch October 29, 2025 17:57
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