Skip to content

feat(catalog-mcp): add updateDataModel - #3573

Open
josemontespg wants to merge 1 commit into
catalogs-mcp-tool-payloadfrom
catalogs-mcp-json-functions
Open

josemontespg wants to merge 1 commit into
catalogs-mcp-tool-payloadfrom
catalogs-mcp-json-functions

Conversation

@josemontespg

@josemontespg josemontespg commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds the updateDataModel data function to the v1 MCP catalog and @a2ui/catalog-mcp, writing each key-value pair of its updates object to the surface data model. Keys starting with / write to absolute paths, while relative keys resolve against the calling data context, such as the current row of a template list.

updateDataModel is declared in catalogs/mcp/v1/catalog.json, registered on mcpCatalog, and exported as UpdateDataModelApi and UpdateDataModelImplementation for hosts that compose their own catalogs. Every key is validated before anything is written (rejecting empty keys and __proto__, constructor, or prototype segments), objects and arrays are cloned before storage, and @path or @call objects inside values are stored as plain data rather than evaluated as expressions.

Changes

  • typescript/catalogs/mcp/src/functions/update_data_model.ts and update_data_model.test.ts: implement UpdateDataModelApi and UpdateDataModelImplementation with path validation and unit tests.
  • typescript/catalogs/mcp/src/catalog.ts and src/index.ts: register UpdateDataModelImplementation on mcpCatalog and export UpdateDataModelApi and UpdateDataModelImplementation.
  • catalogs/mcp/v1/catalog.json and typescript/catalogs/mcp/src/catalog.test.ts: declare updateDataModel in the v1 catalog schema and check parity with mcpCatalog.
  • catalogs/mcp/README.md, typescript/catalogs/mcp/README.md, CHANGELOG.md: document updateDataModel and its path validation rules.

Verification

  • yarn workspace @a2ui/catalog-mcp run test and yarn workspace @a2ui/catalog-mcp run lint: node and karma test suites pass, including update_data_model.test.ts and catalog parity checks.
  • specification/v1_0/test/run_tests.py and ./scripts/fix_format.sh --check pass.

@github-project-automation github-project-automation Bot moved this to Todo in A2UI Oct 23, 2026
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from bed3164 to 2526a71 Compare October 23, 2026 22:55

@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 three new data functions (parseJson, jmespath, and updateDataModel) to the A2UI MCP catalog, enabling surfaces to process headless tool outputs and write them to the data model. It also adds a helper to settle pending asynchronous arguments, comprehensive tests, schema updates, and documentation. Feedback suggests implementing a two-pass validation approach in updateDataModel to prevent prototype pollution and ensure atomic updates.

Comment thread typescript/catalogs/mcp/src/functions/update_data_model.ts Outdated
@josemontespg
josemontespg added this pull request to stack #3585 October 23, 2026 23:38
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 2526a71 to 7569b69 Compare October 23, 2026 23:43
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 7569b69 to 105c151 Compare October 23, 2026 23:56
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 105c151 to bf2af14 Compare October 24, 2026 00:05
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from bf2af14 to 1efcbc5 Compare October 24, 2026 01:11
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 1efcbc5 to 2d8be18 Compare October 24, 2026 01:23
@josemontespg
josemontespg removed this pull request from stack #3585 October 24, 2026 01:26
@josemontespg
josemontespg added this pull request to stack #3594 October 24, 2026 01:26
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 2d8be18 to 6bf1f1d Compare October 24, 2026 01:29
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 6bf1f1d to 9c4b077 Compare October 24, 2026 01:44
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 9c4b077 to 9fef81f Compare October 26, 2026 09:07
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 9fef81f to 402e22d Compare October 26, 2026 09:48
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch 2 times, most recently from cd56db0 to 0a4e4ef Compare October 26, 2026 17:28
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch 2 times, most recently from 39fc1e0 to 82af3eb Compare October 26, 2026 18:18
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from 7cd9e90 to a3b763c Compare October 26, 2026 20:31
@josemontespg
josemontespg removed this pull request from stack #3629 October 26, 2026 20:34
@josemontespg
josemontespg added this pull request to stack #3640 October 26, 2026 20:34
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from a3b763c to bd66c46 Compare October 26, 2026 20:36
@josemontespg
josemontespg removed this pull request from stack #3640 October 26, 2026 21:37
@josemontespg
josemontespg added this pull request to stack #3643 October 26, 2026 21:38
@josemontespg
josemontespg removed this pull request from stack #3643 October 26, 2026 22:01
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from bd66c46 to fc248bd Compare October 26, 2026 22:01
@josemontespg
josemontespg changed the base branch from web-core-export-safe-regex to web-core-settle-async-args October 26, 2026 22:02
Comment thread typescript/catalogs/mcp/package.json Outdated
Comment thread typescript/core/web_core/src/common/settle_deep.ts
@josemontespg
josemontespg added this pull request to stack #3645 October 26, 2026 22:04
@josemontespg
josemontespg removed this pull request from stack #3645 October 26, 2026 23:14
@josemontespg
josemontespg force-pushed the catalogs-mcp-json-functions branch from fc248bd to 11ea93e Compare October 26, 2026 23:14
@josemontespg
josemontespg added this pull request to stack #3647 October 26, 2026 23:17
@josemontespg
josemontespg marked this pull request as ready for review October 26, 2026 23:37
@josemontespg
josemontespg requested a review from ditman October 26, 2026 23:37
@josemontespg
josemontespg removed this pull request from stack #3647 October 27, 2026 00:30
@josemontespg
josemontespg added this pull request to stack #3649 October 27, 2026 00:32

@ditman ditman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As we decided in #3153 and implemented in #3171, general-purpose data transformation functions (parseJson, jmespath, updateDataModel) and the jmespath dependency should not live in catalogs/mcp/v1/catalog.json, conformance/core/catalog.yaml, or @a2ui/catalog-mcp.

Putting these into the v1 MCP catalog specification and conformance suite would require every client SDK implementing the MCP catalog (TypeScript, Flutter/Dart, Swift, etc.) to pull in a third-party JMESPath dependency and implement general ETL functions that are not specific to the MCP protocol. Instead, these functions should remain in the sample application that needs them (samples/community/mcp/a2ui-over-mcp-filesystem).

Note: The fix in typescript/catalogs/mcp/src/functions/callMcpTool.ts (importing DynamicStringSchema and DynamicValueSchema from @a2ui/web_core/v1_0 so @path/@call tool arguments validate in v1.0) is great — please extract that into its own small PR (or fold it into #3577 / #3578) and close this PR.

Comment thread catalogs/mcp/v1/catalog.json Outdated
Comment thread typescript/catalogs/mcp/src/functions/callMcpTool.ts

@ditman ditman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We discussed this offline and I was persuaded of letting some of these functions back in the catalog, even if they aren't directly required for the component to work, they may be generally helpful.

Please, update the documentation to ensure users know how to add their custom functions, we don't want a explosion of random functions becoming part of the catalog.

Comment thread typescript/catalogs/mcp/README.md Outdated

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.

2 participants