fix: tester.html 에서 Tool 실행 시 JSON Schema 타입(integer, number, boolean)에 맞춰 입력값을 자동 형변환하도록 수정
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 11s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 11s
This commit is contained in:
@@ -514,6 +514,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function executeRawCall(name, payload) {
|
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 reqPayload = { jsonrpc: "2.0", method: "tools/call", params: { name: name, arguments: payload }, id: Date.now() };
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user