feat(mcp-agent): support importing tools from MCP JSON schema#1872
Open
pandacooming wants to merge 1 commit intobytedance:mainfrom
Open
feat(mcp-agent): support importing tools from MCP JSON schema#1872pandacooming wants to merge 1 commit intobytedance:mainfrom
pandacooming wants to merge 1 commit intobytedance:mainfrom
Conversation
✅ Deploy Preview for agent-tars-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for tarko ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Add addMcpJson() to McpAgentPlugin for direct JSON paste - Support 3 formats: tools/list response, legacy single-tool (input_schema), single-tool (inputSchema) - Add McpJsonParser with full JSON Schema → Zod conversion - Add DynamicMcpToolRegistry for handler registration - Add comprehensive test suite Fixes bytedance#544
7d53bf7 to
03befe2
Compare
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
Implements Feature Request #544 — add support for importing tools directly from MCP JSON schema, enabling copy-paste usage without running an MCP server.
Changes
New file:
multimodal/omni-tars/mcp-agent/src/tools/mcp-json-parser.tsMcpJsonParser— parses MCP JSON intoTool[]:{ "tools": [...] }input_schemakey):{ "name": "...", "input_schema": {...} }inputSchemakey):{ "name": "...", "inputSchema": {...} }Full JSON Schema → Zod conversion for all primitive types (string, number, integer, boolean, array, object).
DynamicMcpToolRegistry— attaches handler functions to parsed tools by name.Modified:
McpAgentPluginNew public methods:
addMcpJson(mcpJson: string): Tool[]— import tools from a JSON stringregisterHandlers(handlers: Record<string, Handler>)— attach implementationsTests
test/mcp-json-parser.test.ts— 11 TypeScript test cases (via vitest)test/run-standalone-tests.js— 13 pure-JS tests (verified 13/13 pass)Usage Example
Backward Compatibility
✅ Fully backward compatible — existing
mcpServers/ MCP server-based usage is unchanged.Closes #544