fix(server): add .passthrough() to MCP tool output schemas#944
Open
Aarjav Jain (A2rjav) wants to merge 1 commit intobrowseros-ai:devfrom
Open
fix(server): add .passthrough() to MCP tool output schemas#944Aarjav Jain (A2rjav) wants to merge 1 commit intobrowseros-ai:devfrom
Aarjav Jain (A2rjav) wants to merge 1 commit intobrowseros-ai:devfrom
Conversation
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 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
PR author is not in the allowed authors list. |
Contributor
|
All contributors have signed the CLA. Thank you! |
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()onpageInfoSchema(affectsget_active_page,list_pages,show_page,move_page)windows.ts—.passthrough()onwindowInfoSchema+ innerboundsobject; adds missingincognitofieldtab-groups.ts—.passthrough()ontabGroupWithPageIdsSchemabookmarks.ts—.passthrough()onbookmarkNodeSchemahistory.ts—.passthrough()onhistoryItemSchemaconsole.ts—.passthrough()on console entry schemabrowseros_server_updater.cc— removes misplacedLaunchOptionsblock (belonged inprocess_controller_impl.cc)process_controller_impl.cc— injectsBROWSEROS_DIRenv var into launched server process (cross-platform)Test plan
list_windowsreturns results including incognito windows without schema errorlist_pages/get_active_pagework when Chrome returns extra tab fieldslist_tab_groupsreturns results without validation failureget_bookmarks/search_bookmarkswork with Chrome's extra bookmark fieldssearch_history/get_recent_historywork correctlyget_console_logsreturns entries without schema rejection🤖 Generated with Claude Code