Repository navigation
Conversation
…d MCP tools convertMCPServersToTools rebuilt function-tool parameters from only inputSchema.properties/required, dropping top-level $defs/definitions while keeping the $refs that point into them. FastMCP-style servers (official MCP Python SDK) hoist every nested pydantic model to top-level $defs, so any preloaded tool with structured args reached the LLM with dangling #/defs-style refs — failing provider schema validation or hiding the argument shape from the model. Carry both containers over only when present, so schemas without them are emitted byte-identically to before. Fixes #945
Review ask on #1030: check model-vendor compatibility before merging. The converted parameters flow convertTools() -> jsonSchema() -> the configured @ai-sdk provider package. Against the pinned provider sources: @ai-sdk/anthropic preserves both $defs and legacy definitions recursively; @ai-sdk/google passes unknown keywords (and $defs explicitly) through unstripped; @ai-sdk/openai and the OpenAI-compatible vendors ship the parameters JSON Schema verbatim. The tests pin what the converter itself controls: emitted parameters stay on the vendor-accepted top-level surface (type/properties/required plus the two container spellings and nothing else), every local $ref resolves inside the emitted document for both spellings, and container-less schemas are emitted byte-identically so vendor behavior for them is unchanged.
Record a patch bump for @truefoundry/trueforge-core so the preloaded MCP tool schema fix ships in the next release. Co-authored-by: Chirag Jain <jain.chirag925@gmail.com>
🦋 Changeset detectedLatest commit: 0907422 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
4 of 5 tasks
Member
Author
|
closing as duplicate of #1030 |
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
convertMCPServersToToolsrebuilt the function-toolparametersfrom onlyinputSchema.properties/required, dropping top-level$defs/ legacydefinitionswhile keeping the$refs that point into them. FastMCP-style servers hoist nested models to$defs, so preloaded tools reached the LLM with dangling refs.This branch carries the fix from #1030 and adds the missing patch changeset for
@truefoundry/trueforge-core.Fixes #945
Changes
packages/trueforge-core/src/core/mcp/convertMCPServers.ts: passinputSchema.$defsand draft-04inputSchema.definitionsthrough into function-toolparameterswhen present.packages/trueforge-core/tests/core/mcp/..changeset/mcp-inputschema-defs.md: patch bump for@truefoundry/trueforge-core.How was this tested?
$defs,definitions, and no-container schemas.Checklist
@truefoundry/trueforge-core(patch)