Skip to content

feat(forms): Add batch_update_form tool for Google Forms API - #390

Merged
taylorwilsdon merged 4 commits into
taylorwilsdon:mainfrom
ugoano:feature/forms-batch-update
Jan 28, 2026
Merged

feat(forms): Add batch_update_form tool for Google Forms API#390
taylorwilsdon merged 4 commits into
taylorwilsdon:mainfrom
ugoano:feature/forms-batch-update

Conversation

@ugoano

@ugoano ugoano commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds batch_update_form MCP tool exposing the Google Forms batchUpdate API endpoint
  • Supports all request types: createItem, updateItem, deleteItem, moveItem, updateFormInfo, updateSettings
  • Includes _batch_update_form_impl internal function for testability (matching existing _impl pattern from Apps Script tools)
  • Adds 6 unit tests following existing pytest + pytest-asyncio + Mock conventions

Motivation

The Forms module has create_form and get_form but no way to modify form content after creation. The Google Forms API supports batchUpdate natively — this PR exposes it through the MCP server, enabling users to programmatically add questions, update settings, and manage form structure.

Changes

File Change
gforms/forms_tools.py Added _batch_update_form_impl + batch_update_form (+95 lines)
tests/gforms/__init__.py New test package init (empty, matching existing pattern)
tests/gforms/test_forms_tools.py 6 unit tests (+231 lines)

Design Decisions

  • Slides-style pass-through pattern (not Docs-style abstraction) — the Forms module is flat with no managers/helpers, so raw API request pass-through is the consistent choice
  • _impl pattern for testability — separates business logic from MCP decorators, matching gappsscript/apps_script_tools.py
  • No refactoring of existing 5 Forms tools — keeps PR scope minimal

Test Plan

  • 6 new unit tests all pass (pytest tests/gforms/test_forms_tools.py -v)
  • All 18 existing Apps Script tests still pass (no regressions)
  • ruff check passes with no issues
  • No new dependencies added
  • Existing decorator stack used: @server.tool()@handle_http_errors@require_google_service

Add batch_update_form MCP tool that exposes the Google Forms
batchUpdate API endpoint. Supports createItem, updateItem,
deleteItem, moveItem, updateFormInfo, and updateSettings operations.

Includes _batch_update_form_impl internal function for testability
and 6 unit tests covering multiple requests, single request, empty
replies, missing replies key, URL generation, and mixed reply types.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@taylorwilsdon

Copy link
Copy Markdown
Owner

Thanks for the PR! You're missing the tool tiers entry and README docs, but seems like useful capability.

Add batch_update_form to the Complete tier in tool_tiers.yaml and
document it in both README files as requested in PR review.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ugoano

ugoano commented Jan 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review! This is Arno (Ugo's AI assistant) — I've added the tool tiers entry and README docs in b7a2f08. Let me know if anything else needs updating.

@taylorwilsdon
taylorwilsdon requested review from Copilot and taylorwilsdon and removed request for Copilot January 28, 2026 21:33
@taylorwilsdon taylorwilsdon self-assigned this Jan 28, 2026
@taylorwilsdon taylorwilsdon added the enhancement New feature or request label Jan 28, 2026
@taylorwilsdon
taylorwilsdon requested a review from Copilot January 28, 2026 21:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds batch update functionality to the Google Forms module by introducing a new batch_update_form tool that wraps the Google Forms API batchUpdate endpoint, enabling programmatic modification of form content after creation.

Changes:

  • Added batch_update_form tool with internal _batch_update_form_impl function for testability
  • Created comprehensive unit test suite with 6 test cases covering various batch update scenarios
  • Updated documentation to reflect the new tool availability

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gforms/forms_tools.py Implements _batch_update_form_impl and batch_update_form tool supporting all Forms API batch update request types
tests/gforms/test_forms_tools.py Adds 6 unit tests covering multiple requests, single requests, empty/missing replies, URL generation, and mixed reply types
core/tool_tiers.yaml Registers batch_update_form in the "complete" tier for forms
README_NEW.md Updates tool count from 5 to 6 and adds batch_update_form to the forms tools table
README.md Adds batch_update_form entry to the forms tools table

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
"createItem": {
"item": {
"title": "Favourite colour?",

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'Favourite' to 'Favorite' to match American English spelling convention.

Suggested change
"title": "Favourite colour?",
"title": "Favorite color?",

Copilot uses AI. Check for mistakes.
@taylorwilsdon
taylorwilsdon merged commit 6464c3c into taylorwilsdon:main Jan 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants