Skip to content

feat: add insertTableWithData tool for pre-populated table insertion#74

Merged
a-bonus merged 1 commit intoa-bonus:mainfrom
elijahr:elijahr/insert-table-with-data
Feb 25, 2026
Merged

feat: add insertTableWithData tool for pre-populated table insertion#74
a-bonus merged 1 commit intoa-bonus:mainfrom
elijahr:elijahr/insert-table-with-data

Conversation

@elijahr
Copy link
Copy Markdown
Contributor

@elijahr elijahr commented Feb 25, 2026

Summary

Adds a new insertTableWithData tool that creates a Google Docs table pre-populated with cell data in a single batch API call. Currently, populating a table requires insertTablereadGoogleDoc (to discover cell indices) → multiple insertText calls. This tool collapses that into one step.

Changes

  • New: src/tools/docs/insertTableWithData.ts — Tool implementation using proven table index math from markdownToDocs.ts. Exports buildInsertTableWithDataRequests pure function for testability.
  • New: src/tools/docs/insertTableWithData.test.ts — 17 unit tests covering table structure, cell index math, empty cells, header bolding, tabId propagation, ragged rows, and error handling.
  • Modified: src/tools/docs/index.ts — Added import and registration.

Parameters

Parameter Type Required Description
documentId string Yes The document ID
data string[][] Yes 2D array of cell contents (each inner array is one row)
index number (int) Yes 1-based character index for table insertion
hasHeaderRow boolean No Bold the first row (default: false)
tabId string No Target a specific tab

Testing

  • 17 Vitest unit tests (all passing) covering index math, ragged rows, empty cells, header bolding, tabId propagation, and error cases.
  • Build passes (tsc with zero errors).
  • Prettier formatting passes.

@a-bonus a-bonus merged commit bb2c961 into a-bonus:main Feb 25, 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