Files
n8n-mcp/src/types/index.ts
czlonkowski 198e773bb3 feat: add n8n_generate_workflow tool for hosted workflow generation
Add new MCP tool that enables AI-powered workflow generation from natural
language descriptions. Uses handler delegation pattern — hosting environments
inject a GenerateWorkflowHandler via EngineOptions, self-hosted instances
receive a hosted-only informational response.

Handler flows through N8NMCPEngine → SingleSessionHTTPServer →
N8NDocumentationMCPServer with helpers for createWorkflow, validateWorkflow,
autofixWorkflow, and getWorkflow.

Includes full tool documentation, tests, and corrected tools overview count.

Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 12:32:31 +02:00

70 lines
1.8 KiB
TypeScript

// Export n8n node type definitions and utilities
export * from './node-types';
export * from './type-structures';
export * from './instance-context';
export * from './session-state';
export * from './generate-workflow';
export interface MCPServerConfig {
port: number;
host: string;
authToken?: string;
}
/**
* MCP Tool annotations to help AI assistants understand tool behavior.
* Per MCP spec: https://spec.modelcontextprotocol.io/specification/2025-03-26/server/tools/#annotations
*/
export interface ToolAnnotations {
/** Human-readable title for the tool */
title?: string;
/** If true, the tool does not modify its environment */
readOnlyHint?: boolean;
/** If true, the tool may perform destructive updates to its environment */
destructiveHint?: boolean;
/** If true, calling the tool repeatedly with the same arguments has no additional effect */
idempotentHint?: boolean;
/** If true, the tool may interact with external entities (APIs, services) */
openWorldHint?: boolean;
}
export interface ToolDefinition {
name: string;
description: string;
inputSchema: {
type: string;
properties: Record<string, any>;
required?: string[];
additionalProperties?: boolean | Record<string, any>;
};
outputSchema?: {
type: string;
properties: Record<string, any>;
required?: string[];
additionalProperties?: boolean | Record<string, any>;
};
/** Tool behavior hints for AI assistants */
annotations?: ToolAnnotations;
_meta?: {
ui?: {
resourceUri?: string;
};
};
}
export interface ResourceDefinition {
uri: string;
name: string;
description?: string;
mimeType?: string;
}
export interface PromptDefinition {
name: string;
description?: string;
arguments?: Array<{
name: string;
description?: string;
required?: boolean;
}>;
}