From ba65417119461a906f2d121f6a0a4a30895962f0 Mon Sep 17 00:00:00 2001 From: jade Date: Thu, 27 Aug 2026 14:16:42 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20tester.html=20=EC=97=90=EC=84=9C=20Tool?= =?UTF-8?q?=20=EC=8B=A4=ED=96=89=20=EC=8B=9C=20JSON=20Schema=20=ED=83=80?= =?UTF-8?q?=EC=9E=85(integer,=20number,=20boolean)=EC=97=90=20=EB=A7=9E?= =?UTF-8?q?=EC=B6=B0=20=EC=9E=85=EB=A0=A5=EA=B0=92=EC=9D=84=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=20=ED=98=95=EB=B3=80=ED=99=98=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/tester.html | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dat-gateway/src/main/resources/static/tester.html b/dat-gateway/src/main/resources/static/tester.html index fbb6eade..fa469e2f 100644 --- a/dat-gateway/src/main/resources/static/tester.html +++ b/dat-gateway/src/main/resources/static/tester.html @@ -513,8 +513,24 @@ } } - async function executeRawCall(name, payload) { - const reqPayload = { jsonrpc: "2.0", method: "tools/call", params: { name: name, arguments: payload }, id: Date.now() }; +async function executeRawCall(name, payload) { + // Auto-coerce payload types based on schema to prevent JSON validation errors + const tool = allTools.find(t => t.name === name); + if (tool && tool.inputSchema && tool.inputSchema.properties) { + const props = tool.inputSchema.properties; + for (const key in payload) { + if (props[key]) { + const type = props[key].type; + if ((type === 'integer' || type === 'number') && typeof payload[key] === 'string') { + const parsed = Number(payload[key]); + if (!isNaN(parsed)) payload[key] = parsed; + } else if (type === 'boolean' && typeof payload[key] === 'string') { + payload[key] = payload[key].toLowerCase() === 'true'; + } + } + } + } + const reqPayload = { jsonrpc: "2.0", method: "tools/call", params: { name: name, arguments: payload }, id: Date.now() }; const startTime = Date.now(); try { const response = await fetch('/mcp/api/v1/tools/call', {