fix: serialize Tool schema as parameters instead of parametersSchema#3
Open
pjperez wants to merge 1 commit intocopilot-community-sdk:mainfrom
Open
fix: serialize Tool schema as parameters instead of parametersSchema#3pjperez wants to merge 1 commit intocopilot-community-sdk:mainfrom
parameters instead of parametersSchema#3pjperez wants to merge 1 commit intocopilot-community-sdk:mainfrom
Conversation
The custom Serialize impl for Tool emitted the JSON key `parametersSchema`,
but the Copilot CLI reads `parameters` when mapping external tool
definitions (mapProtocolExternalTools in the CLI bundle). This mismatch
caused every SDK-registered tool's schema to be silently dropped — the
CLI fell back to an empty schema ({type: "object", properties: {}}) so
the model never saw the tool's properties or required fields.
The official Python SDK also uses `parameters` as the serialized field
name (github/copilot-sdk@c4b3b36, copilot/types.py L138), confirming
this is the expected wire format.
Only the serialized JSON key changes; the Rust struct field
(parameters_schema) and the builder method (.schema()) are unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
The custom
Serializeimpl forToolemitted the JSON keyparametersSchema, but the Copilot CLI readsparameterswhen mapping external tool definitions. This mismatch caused every SDK-registered tool's schema to be silently dropped — the CLI fell back to an empty schema ({type: "object", properties: {}}) so the model never saw the tool's properties or required fields.This was correct before 46f093f#diff-ed12f5ea605f23bb4d26cc65778e3daff9db3eec40e2abfc82beafca130a99a0 that introduced the change.
Root cause
In
src/types.rs, theToolserializer used:Since
n.parameterswas always undefined, the CLI fell back to:Fix
One-line change — serialize the field as parameters instead of parametersSchema:
The Rust struct field (parameters_schema) and the builder method (.schema()) are unchanged.
Verification
Impact
Every tool registered via the SDK's Tool struct had its schema silently dropped. The model only saw name and description, and had
to guess what arguments to provide. Tools with required parameters failed because the model didn't know to supply them.