Repository navigation
feat(catalog-mcp): write tool results to targetDataPath and return them - #3728
Open
josemontespg wants to merge 1 commit into
Open
josemontespg wants to merge 1 commit into
josemontespg wants to merge 1 commit into
Conversation
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 28, 2026 22:43
a821b7a to
53c6f2a
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the callMcpTool function in the MCP catalog to return a structured McpToolDataPayload containing the tool name, resolved input, raw result, structured content, joined text blocks, and parsed JSON. It also updates targetDataPath handling to write this payload to the specified path, ensuring that only the latest call writes to prevent out-of-order response overwrites. The changes include updated documentation, schema descriptions, conformance tests, and comprehensive unit tests. One piece of feedback suggests using Object.hasOwn instead of the in operator in the tests to avoid prototype lookup issues.
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 28, 2026 22:45
53c6f2a to
3248ba6
Compare
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 28, 2026 22:49
3248ba6 to
e6f60a9
Compare
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 28, 2026 23:21
e6f60a9 to
f331744
Compare
josemontespg
commented
Oct 28, 2026
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 28, 2026 23:42
f331744 to
439e554
Compare
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 29, 2026 00:22
439e554 to
c7abb66
Compare
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 29, 2026 00:59
c7abb66 to
436a91b
Compare
josemontespg
marked this pull request as ready for review
October 29, 2026 17:05
ditman
reviewed
Oct 29, 2026
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 29, 2026 18:28
436a91b to
2d5acbc
Compare
josemontespg
changed the base branch from
main
to
catalogs-mcp-json-functions
October 30, 2026 20:56
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 30, 2026 20:57
2d5acbc to
d2c4c5b
Compare
Most MCP tools return plain text or JSON content rather than A2UI resources. callMcpTool now returns one payload for every call: toolName, toolInput, toolResult, structuredContent when the server sends one, the joined text blocks, and their json parse (or an array of the per-block parses when a server sends one JSON block per row). With targetDataPath set, each call replaces the object at that path, and a response that arrives after a newer call to the same path has started is not written, so the latest call wins. callMcpTool validates its arguments with the v1.0 schemas, so a tool argument bound with @path validates, and the published v1 MCP catalog gets from_json and round_trip conformance cases.
josemontespg
force-pushed
the
catalogs-mcp-tool-payload
branch
from
October 30, 2026 21:41
d2c4c5b to
037c50e
Compare
This branch has not been deployed
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
Most MCP tools return plain text or JSON content rather than A2UI resources, and until now
callMcpToolhanded back the rawCallToolResult, which a payload could not use without client code.callMcpToolnow returns one payload for every call:toolName,toolInput,toolResult,structuredContentwhen the server sends one, thetextblocks joined with newlines, and theirjsonparse, or an array of the per-block parses when a server sends one JSON block per row. When the result carries an MCP App resource, the payload also carries itsresourceUri,html,cspandpermissions.With
targetDataPathset, each successful call replaces the object at that path with its payload. A response that arrives after a newer call to the same path has started is not written, so the latest call wins, which keeps out-of-order responses such as autocomplete suggestions from overwriting newer ones. A result flaggedisErrorfails the call and writes nothing.callMcpToolnow validates its arguments with the v1.0 schemas, so a tool argument bound with@pathvalidates when the surface is processed, and the published v1 MCP catalog getsfrom_jsonandround_tripconformance cases.Changes
typescript/catalogs/mcp/src/functions/callMcpTool.ts: addMcpToolDataPayloadandextractToolResultContent, build the payload on every call, write it totargetDataPathunless a newer call to that path has started, return it, and validate arguments with the v1.0DynamicStringandDynamicValueschemas.typescript/catalogs/mcp/src/components/mcp_app.ts: read the raw result frompayload.toolResultwhen forwarding a tool call to an app.typescript/catalogs/mcp/src/index.ts: export theMcpToolDataPayloadtype.catalogs/mcp/v1/catalog.json: describe the payload oncallMcpTooland the replace and latest-call-wins rules ontargetDataPath.conformance/core/catalog.yaml: addfrom_json(self-contained) andround_tripcases for the published v1 MCP catalog.catalogs/mcp/README.md,typescript/catalogs/mcp/README.md,CHANGELOG.md: document the payload fields,targetDataPath, and the v1.0 call shape withcatalogIdon the call.Verification
yarn workspace @a2ui/catalog-mcp run test: node and karma suites pass, including the newtool data payloadtests incallMcpTool.test.ts(payload fields, JSON per-block parsing,targetDataPathreplace and latest-call-wins, no write onisError).specification/v1_0/test/run_tests.pyand./scripts/fix_format.sh --checkpass.