fix: resolve MCP protocol test failures by fixing response format expectations
- Fixed test-helpers.ts to correctly wrap executeTool responses in MCP format
- Updated all tests to expect correct response structures:
- list_nodes returns {nodes: [...], totalCount}
- search_nodes returns {query, results: [...], totalCount, mode?}
- list_ai_tools returns {tools: [...]}
- list_tasks returns {totalTasks, categories: {...}} or {category, tasks: [...]}
- Fixed property expectations (nodeType instead of name, etc.)
- Reduced failing tests from 67 to 7
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -51,15 +51,9 @@ export class TestableN8NMCPServer {
|
||||
// Call tool handler
|
||||
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
||||
try {
|
||||
// The mcpServer.executeTool returns raw data, we need to wrap it in the MCP response format
|
||||
const result = await this.mcpServer.executeTool(request.params.name, request.params.arguments || {});
|
||||
|
||||
// Convert result to content array if needed
|
||||
if (Array.isArray(result) && result.length > 0 && result[0].content) {
|
||||
return {
|
||||
content: result[0].content
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user