n8n_health_check
Verify n8n instance connectivity and validate API credentials to ensure proper integration with Cursor IDE's workflow management capabilities.
Instructions
Check the connection to the n8n instance and verify API credentials.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:139-174 (handler)The primary handler function for the 'n8n_health_check' tool. It initializes the N8nApiClient, performs a health check, and returns a formatted response indicating connection status.private async handleHealthCheck(): Promise<ToolResult> { try { const client = this.initializeApiClient(); const result = await client.healthCheck(); return { content: [ { type: 'text' as const, text: JSON.stringify({ status: result.status, apiUrl: process.env.N8N_API_URL, message: result.status === 'connected' ? 'Successfully connected to n8n instance' : `Connection failed: ${result.version}`, }, null, 2), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { content: [ { type: 'text' as const, text: JSON.stringify({ status: 'error', apiUrl: process.env.N8N_API_URL || 'Not configured', message: errorMessage, }, null, 2), }, ], isError: true, }; } }
- src/server.ts:114-116 (handler)Dispatch logic in handleToolCall method that routes 'n8n_health_check' calls to the dedicated handleHealthCheck function.if (name === 'n8n_health_check') { return this.handleHealthCheck(); }
- src/tools/execution-tools.ts:100-106 (schema)Tool schema/definition including name, description, and empty input schema (no parameters required).name: 'n8n_health_check', description: 'Check the connection to the n8n instance and verify API credentials.', inputSchema: { type: 'object', properties: {}, }, },
- src/tools/index.ts:12-16 (registration)Registration of the tool via aggregation into allTools array, which includes executionTools containing 'n8n_health_check'.export const allTools: ToolDefinition[] = [ ...documentationTools, // Documentation first for discoverability ...workflowTools, ...executionTools, ];
- Supporting healthCheck method in N8nApiClient that verifies API connectivity by attempting to list workflows./** * Check n8n API connectivity */ async healthCheck(): Promise<{ status: string; version?: string }> { try { // Try to list workflows with limit 1 to verify connection await this.request<N8nListResponse<N8nWorkflow>>('/workflows?limit=1'); return { status: 'connected' }; } catch (error) { return { status: 'error', version: error instanceof Error ? error.message : 'Unknown error' }; } }