Describe the bug
The list tools call returns unnecessary fields. To me, this seems unintended.
To Reproduce
Declare a tool
/// Parameters for adding two numbers.
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
struct AddRequest {
/// The left-hand number.
a: f64,
/// The right-hand number.
b: f64,
}
/// Add two numbers.
#[rmcp::tool]
fn add(Parameters(AddRequest { a, b }): Parameters<AddRequest>) -> String {
(a + b).to_string()
}
The list tools call currently returns
{
"name": "add",
"description": "Add two numbers.",
"inputSchema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Parameters for adding two numbers.",
"title": "AddRequest",
"type": "object",
"properties": {
"a": {
"description": "The left-hand number.",
"format": "double",
"type": "number"
},
"b": {
"description": "The right-hand number.",
"format": "double",
"type": "number"
}
},
"required": [
"a",
"b"
]
}
}
Expected behavior
The same answer, but without the fields with Parameters for adding two numbers and AddRequest:
{
"name": "add",
"description": "Add two numbers.",
"inputSchema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"a": {
"description": "The left-hand number.",
"format": "double",
"type": "number"
},
"b": {
"description": "The right-hand number.",
"format": "double",
"type": "number"
}
},
"required": [
"a",
"b"
]
}
}
Since 2020-12 is the default schema, we could even say that to minimize the answer the $schema can be omitted.
Describe the bug
The list tools call returns unnecessary fields. To me, this seems unintended.
To Reproduce
Declare a tool
The list tools call currently returns
{ "name": "add", "description": "Add two numbers.", "inputSchema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "description": "Parameters for adding two numbers.", "title": "AddRequest", "type": "object", "properties": { "a": { "description": "The left-hand number.", "format": "double", "type": "number" }, "b": { "description": "The right-hand number.", "format": "double", "type": "number" } }, "required": [ "a", "b" ] } }Expected behavior
The same answer, but without the fields with
Parameters for adding two numbersandAddRequest:{ "name": "add", "description": "Add two numbers.", "inputSchema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "a": { "description": "The left-hand number.", "format": "double", "type": "number" }, "b": { "description": "The right-hand number.", "format": "double", "type": "number" } }, "required": [ "a", "b" ] } }Since
2020-12is the default schema, we could even say that to minimize the answer the$schemacan be omitted.