From 514f0efdb7ffc047f119d042257821389e55bc0e Mon Sep 17 00:00:00 2001 From: LiuHanZhi Date: Tue, 7 Jul 2026 00:34:47 +0800 Subject: [PATCH] docs: fix Tool inputSchema example to produce valid JSON Schema The previous example was missing the required 'type' declaration and used plain strings instead of proper JSON Schema property objects. Fixes #128 --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1bf1670a..5c8521c0 100644 --- a/README.md +++ b/README.md @@ -703,9 +703,16 @@ await server.withMethodHandler(ListTools.self) { _ in name: "weather", description: "Get current weather for a location", inputSchema: .object([ + "type": .string("object"), "properties": .object([ - "location": .string("City name or coordinates"), - "units": .string("Units of measurement, e.g., metric, imperial") + "location": .object([ + "type": .string("string"), + "description": .string("City name or coordinates") + ]), + "units": .object([ + "type": .string("string"), + "description": .string("Units of measurement, e.g., metric, imperial") + ]) ]) ]) ), @@ -713,8 +720,12 @@ await server.withMethodHandler(ListTools.self) { _ in name: "calculator", description: "Perform calculations", inputSchema: .object([ + "type": .string("object"), "properties": .object([ - "expression": .string("Mathematical expression to evaluate") + "expression": .object([ + "type": .string("string"), + "description": .string("Mathematical expression to evaluate") + ]) ]) ]) )