Skip to content

feat(catalog-mcp): add the MCP JSON tool result example - #3729

Open
josemontespg wants to merge 1 commit into
catalogs-mcp-transform-datafrom
catalogs-mcp-json-example
Open

josemontespg wants to merge 1 commit into
catalogs-mcp-transform-datafrom
catalogs-mcp-json-example

Conversation

@josemontespg

@josemontespg josemontespg commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR adds catalogs/mcp/v1/examples/mcp-json-tool-result.json, a message sequence that loads the open issues of a repository from a headless list_issues tool, next to the basic catalog. One button chains callMcpTool, transformData and updateDataModel to fill a template list from the json of the payload; a second button only sets targetDataPath and binds a list to the structuredContent of the payload written there.

catalog.test.ts processes the example with a mock client that returns the issues both as JSON text and as structured content, runs both button actions through DataContext.resolveAction, and checks the data model after each. Both READMEs now point at the example from the sections that use its actions.

Changes

  • catalogs/mcp/v1/examples/mcp-json-tool-result.json: the example surface, with load_button (chained functions into /issues) and load_all_button (targetDataPath: "/issueResponse").
  • typescript/catalogs/mcp/src/catalog.test.ts: createToolClient and actionOf helpers and three cases: the example processes next to the basic catalog, the first action writes the shaped issues to /issues, the second writes the payload to /issueResponse.
  • catalogs/mcp/README.md: list the example and reference its two buttons from the data functions section.
  • typescript/catalogs/mcp/README.md: link the example from "Shape a headless tool result".

Verification

  • yarn workspace @a2ui/catalog-mcp run test: node and karma suites pass, including the three new the JSON tool result example cases.
  • specification/v1_0/test/run_tests.py validates the example against the v1 MCP and basic catalogs; ./scripts/fix_format.sh --check passes.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a new example file mcp-json-tool-result.json that demonstrates two ways to load and handle headless MCP tool results: by chaining data functions (callMcpTool, transformData, and updateDataModel) or by utilizing targetDataPath. The documentation in both the main and TypeScript catalog READMEs has been updated to reference this example, and corresponding unit tests have been added to catalog.test.ts. Feedback on the changes suggests improving the robustness of the mock MCP client in the tests by using optional chaining to safely handle potentially undefined request parameters.

@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from d1fd202 to 59348df Compare October 28, 2026 22:45
@josemontespg
josemontespg added this pull request to stack #3730 October 28, 2026 22:46
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from 59348df to d92c61d Compare October 28, 2026 22:49
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from d92c61d to d551bc8 Compare October 28, 2026 23:21
@josemontespg
josemontespg removed this pull request from stack #3730 October 28, 2026 23:42
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from d551bc8 to 56599ad Compare October 28, 2026 23:42
@josemontespg
josemontespg added this pull request to stack #3733 October 28, 2026 23:44
@josemontespg
josemontespg removed this pull request from stack #3733 October 29, 2026 00:22
@josemontespg
josemontespg changed the base branch from catalogs-mcp-json-functions to catalogs-mcp-transform-data October 29, 2026 00:22
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from 56599ad to 7c47873 Compare October 29, 2026 00:26
@josemontespg
josemontespg added this pull request to stack #3737 October 29, 2026 00:28
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from 7c47873 to 4f9712f Compare October 29, 2026 01:01
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from 4f9712f to 6987b54 Compare October 29, 2026 17:15
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from 6987b54 to 0a205d4 Compare October 29, 2026 17:36
@josemontespg
josemontespg marked this pull request as ready for review October 29, 2026 17:44
@josemontespg
josemontespg requested a review from ditman October 29, 2026 17:44
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from 0a205d4 to 4348a62 Compare October 29, 2026 18:28
@josemontespg
josemontespg removed this pull request from stack #3737 October 30, 2026 20:56
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from 4348a62 to f783e1c Compare October 30, 2026 20:57
@josemontespg
josemontespg added this pull request to stack #3796 October 30, 2026 20:58
mcp-json-tool-result.json loads the open issues of a repository from a headless list_issues tool. One button chains callMcpTool, transformData and updateDataModel to fill a template list from the json of the payload, and a second button writes the payload to targetDataPath and binds a list to its structuredContent. catalog.test.ts runs both actions against a mock client, and both READMEs point at the example.
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-example branch from f783e1c to 9117d22 Compare October 30, 2026 21:41
@josemontespg
josemontespg removed this pull request from stack #3796 October 30, 2026 21:43
@josemontespg
josemontespg added this pull request to stack #3797 October 30, 2026 21:43

This branch has not been deployed

No deployments
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.

1 participant