Skip to main content

build_schema

Function build_schema 

Source
pub fn build_schema(server: &str, tool: &McpTool) -> Result<Value, String>
Expand description

Build the OpenAI-shape function descriptor for one discovered tool.

Why: the server told us the real argument shape, so passing its inputSchema through gives the model accurate arguments instead of an unconstrained object. What: Err with a reason when the schema is over MAX_INPUT_SCHEMA_BYTES — the caller turns that into an issue and SKIPS the tool, per the #5428 ruling. A server that advertises no object schema at all gets an empty-object one, which is a missing shape rather than an abusive one. Test: super::tests::tool_tests::an_oversized_input_schema_is_rejected, super::tests::tool_tests::an_absent_input_schema_falls_back_to_an_open_object.