mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
fix: add structuredContent to HTTP wrapper for validation tools (#343)
Merging PR #343 - fixes MCP protocol error -32600 for validation tools via HTTP transport. The integration test failures are due to MSW/CI infrastructure issues with external contributor PRs (mock server not responding), NOT the code changes. The fix has been manually tested and verified working with n8n-nodes-mcp community node. Tests pass locally and the code is correct.
This commit is contained in:
@@ -404,16 +404,25 @@ export async function startFixedHTTPServer() {
|
||||
|
||||
try {
|
||||
const result = await mcpServer.executeTool(toolName, toolArgs);
|
||||
|
||||
// Build MCP-compliant response with structuredContent for validation tools
|
||||
const mcpResult: any = {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// Add structuredContent for validation tools (they have outputSchema)
|
||||
if (toolName.startsWith('validate_')) {
|
||||
mcpResult.structuredContent = result;
|
||||
}
|
||||
|
||||
response = {
|
||||
jsonrpc: '2.0',
|
||||
result: {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}
|
||||
]
|
||||
},
|
||||
result: mcpResult,
|
||||
id: jsonRpcRequest.id
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user