Skip to content

Insted of sending tool result content in string format use structuredContent and outputSchema. #28

@jeet-at

Description

@jeet-at

Specification link : https://modelcontextprotocol.io/specification/draft/server/tools#output-schema

Tools may also provide an output schema for validation of structured results. If an output schema is provided.

Example tool with output schema:
{ "name": "get_weather_data", "description": "Get current weather data for a location", "inputSchema": { "type": "object", "properties": { "location": { "type": "string", "description": "City name or zip code" } }, "required": ["location"] }, "outputSchema": { "type": "object", "properties": { "temperature": { "type": "number", "description": "Temperature in celsius" }, "conditions": { "type": "string", "description": "Weather conditions description" }, "humidity": { "type": "number", "description": "Humidity percentage" } }, "required": ["temperature", "conditions", "humidity"] } }

Example valid response for this tool:

{ "jsonrpc": "2.0", "id": 5, "result": { "content": [ { "type": "text", "text": "{\"temperature\": 22.5, \"conditions\": \"Partly cloudy\", \"humidity\": 65}" } ], "structuredContent": { "temperature": 22.5, "conditions": "Partly cloudy", "humidity": 65 } } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions