fix: tester.html 에서 Tool 실행 시 JSON Schema 타입(integer, number, boolean)에 맞춰 입력값을 자동 형변환하도록 수정
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 11s

This commit is contained in:
jade
2026-08-27 14:16:42 +09:00
parent e73a006bac
commit ba65417119

View File

@@ -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', {