Skip to content

fix(server): add .passthrough() to MCP tool output schemas#944

Open
Aarjav Jain (A2rjav) wants to merge 1 commit into
browseros-ai:devfrom
A2rjav:fix/929-mcp-tool-schema-passthrough
Open

fix(server): add .passthrough() to MCP tool output schemas#944
Aarjav Jain (A2rjav) wants to merge 1 commit into
browseros-ai:devfrom
A2rjav:fix/929-mcp-tool-schema-passthrough

Conversation

@A2rjav
Copy link
Copy Markdown

@A2rjav Aarjav Jain (A2rjav) commented May 5, 2026

Summary

Closes #929

Chrome APIs return extra fields alongside the known fields in their responses. Zod's default strict mode rejects unknown fields, causing MCP tool failures whenever Chrome returns an unexpected key.

Root cause: Zod objects without .passthrough() strip (or in structured-output mode, reject) extra keys. Chrome's tab, window, bookmark, history, tab-group, and console APIs all return fields beyond what the schemas declared.

Changes:

  • navigation.ts.passthrough() on pageInfoSchema (affects get_active_page, list_pages, show_page, move_page)
  • windows.ts.passthrough() on windowInfoSchema + inner bounds object; adds missing incognito field
  • tab-groups.ts.passthrough() on tabGroupWithPageIdsSchema
  • bookmarks.ts.passthrough() on bookmarkNodeSchema
  • history.ts.passthrough() on historyItemSchema
  • console.ts.passthrough() on console entry schema
  • browseros_server_updater.cc — removes misplaced LaunchOptions block (belonged in process_controller_impl.cc)
  • process_controller_impl.cc — injects BROWSEROS_DIR env var into launched server process (cross-platform)

Test plan

  • list_windows returns results including incognito windows without schema error
  • list_pages / get_active_page work when Chrome returns extra tab fields
  • list_tab_groups returns results without validation failure
  • get_bookmarks / search_bookmarks work with Chrome's extra bookmark fields
  • search_history / get_recent_history work correctly
  • get_console_logs returns entries without schema rejection

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

PR author is not in the allowed authors list.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

All contributors have signed the CLA. Thank you!
Posted by the CLA Assistant Lite bot.

@A2rjav
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Closes browseros-ai#929

Chrome APIs return extra fields not listed in Zod schemas. Zod strict mode
rejects unknown fields, causing tool failures across multiple tools.

- Add .passthrough() to pageInfoSchema (navigation)
- Add .passthrough() + incognito field to windowInfoSchema (windows)
- Add .passthrough() to tabGroupWithPageIdsSchema (tab-groups)
- Add .passthrough() to bookmarkNodeSchema (bookmarks)
- Add .passthrough() to historyItemSchema (history)
- Add .passthrough() to console entry schema (console)
- Move misplaced LaunchOptions block out of browseros_server_updater.cc
- Inject BROWSEROS_DIR env var into launched server process
@A2rjav Aarjav Jain (A2rjav) force-pushed the fix/929-mcp-tool-schema-passthrough branch from 3c79a46 to 48086b7 Compare May 12, 2026 16:34
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.

[Bug] MCP Server v0.0.82 - Multiple tool implementation failures (window management, PDF, DOM)

1 participant