fix: use inputSchema for MCP tool definitions in tester.html
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 14s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 14s
This commit is contained in:
@@ -372,7 +372,7 @@
|
|||||||
function generateDummyPayload(tool) {
|
function generateDummyPayload(tool) {
|
||||||
if (tool._customPayload) return tool._customPayload;
|
if (tool._customPayload) return tool._customPayload;
|
||||||
|
|
||||||
const schema = tool.parametersSchema;
|
const schema = (tool.inputSchema || tool.parametersSchema);
|
||||||
if (!schema || !schema.properties) return {};
|
if (!schema || !schema.properties) return {};
|
||||||
const payload = {};
|
const payload = {};
|
||||||
for (const [key, value] of Object.entries(schema.properties)) {
|
for (const [key, value] of Object.entries(schema.properties)) {
|
||||||
@@ -761,7 +761,7 @@ async function executeRawCall(name, payload) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderSmartForm(tool, payloadToUse = null) {
|
function renderSmartForm(tool, payloadToUse = null) {
|
||||||
const schema = tool.parametersSchema;
|
const schema = (tool.inputSchema || tool.parametersSchema);
|
||||||
const form = document.getElementById('payloadFormContainer');
|
const form = document.getElementById('payloadFormContainer');
|
||||||
form.innerHTML = '';
|
form.innerHTML = '';
|
||||||
|
|
||||||
@@ -1063,8 +1063,8 @@ async function executeRawCall(name, payload) {
|
|||||||
// Or we just map /mcp/api/v1/tools/call and use tool names as different request bodies,
|
// Or we just map /mcp/api/v1/tools/call and use tool names as different request bodies,
|
||||||
// but for documentation purposes, mapping them as separate virtual paths is usually better to view in Swagger UI.
|
// but for documentation purposes, mapping them as separate virtual paths is usually better to view in Swagger UI.
|
||||||
currentExportJson.forEach(tool => {
|
currentExportJson.forEach(tool => {
|
||||||
const schemaProps = tool.parametersSchema?.properties || {};
|
const schemaProps = (tool.inputSchema || tool.parametersSchema)?.properties || {};
|
||||||
const required = tool.parametersSchema?.required || [];
|
const required = (tool.inputSchema || tool.parametersSchema)?.required || [];
|
||||||
|
|
||||||
paths[`/mcp/api/v1/tools/call?name=${tool.name}`] = {
|
paths[`/mcp/api/v1/tools/call?name=${tool.name}`] = {
|
||||||
post: {
|
post: {
|
||||||
@@ -1148,8 +1148,8 @@ async function executeRawCall(name, payload) {
|
|||||||
md += `### \`${tool.name}\`\n\n`;
|
md += `### \`${tool.name}\`\n\n`;
|
||||||
md += `**Description:** ${tool.description || 'N/A'}\n\n`;
|
md += `**Description:** ${tool.description || 'N/A'}\n\n`;
|
||||||
|
|
||||||
const props = tool.parametersSchema?.properties || {};
|
const props = (tool.inputSchema || tool.parametersSchema)?.properties || {};
|
||||||
const reqs = tool.parametersSchema?.required || [];
|
const reqs = (tool.inputSchema || tool.parametersSchema)?.required || [];
|
||||||
|
|
||||||
if (Object.keys(props).length > 0) {
|
if (Object.keys(props).length > 0) {
|
||||||
md += `#### Parameters\n\n`;
|
md += `#### Parameters\n\n`;
|
||||||
|
|||||||
Reference in New Issue
Block a user