Skip to content

Comments

fix: serialize Tool schema as parameters instead of parametersSchema#3

Open
pjperez wants to merge 1 commit intocopilot-community-sdk:mainfrom
pjperez:fix/tool-parameters-field-name
Open

fix: serialize Tool schema as parameters instead of parametersSchema#3
pjperez wants to merge 1 commit intocopilot-community-sdk:mainfrom
pjperez:fix/tool-parameters-field-name

Conversation

@pjperez
Copy link

@pjperez pjperez commented Feb 21, 2026

Summary

The custom Serialize impl for Tool emitted the JSON key parametersSchema, but the Copilot CLI reads parameters when 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, the Tool serializer used:

state.serialize_field("parametersSchema", &self.parameters_schema)?;

The CLI's mapProtocolExternalTools reads n.parameters, not n.parametersSchema:

// CLI: mapProtocolExternalTools
e.map(n => ({
    name: n.name,
    description: n.description,
    parameters: n.parameters  // reads "parameters"
}))

Since n.parameters was always undefined, the CLI fell back to:

   input_schema: b.parameters ?? {type: "object", properties: {}}

Fix

One-line change — serialize the field as parameters instead of parametersSchema:

   state.serialize_field("parameters", &self.parameters_schema)?;

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.

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>
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