UNPKG

@mondaydotcomorg/atp-mcp-adapter

Version:

MCP compatibility adapter for Agent Tool Protocol

36 lines 1.16 kB
export function convertMCPInputSchema(inputSchema) { const schema = inputSchema; if (!schema) { return { type: 'object', properties: {} }; } const result = {}; result.type = schema.type || 'object'; if (result.type === 'object') { result.properties = schema.properties || {}; } else if (schema.properties) { result.properties = schema.properties; } if (schema.required && schema.required.length > 0) { result.required = schema.required; } if (schema.description) { result.description = schema.description; } const knownFields = new Set(['type', 'properties', 'required', 'description']); for (const [key, value] of Object.entries(schema)) { if (!knownFields.has(key) && value !== undefined) { result[key] = value; } } return result; } export function convertMCPToolToFunction(tool, handler) { return { name: tool.name, description: tool.description || `MCP tool: ${tool.name}`, inputSchema: convertMCPInputSchema(tool.inputSchema), handler, }; } //# sourceMappingURL=schema-utils.js.map