/**
 * Extractor for MCP tool documentation
 *
 * This defines all MCP tools with their descriptions and parameters.
 * The data is extracted from the tool registration files (tools-query.ts, tools-template.ts, tools-pattern.ts, tools-export.ts).
 */
/**
 * MCP tool definitions - single source of truth for tool documentation
 */
export const MCP_TOOLS = [
    // Query tools (tools-query.ts)
    {
        name: 'fw_describe',
        description: 'Describe a workflow in LLM-friendly format (nodes, connections, graph, validation).',
        category: 'query',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow .ts file',
                required: true,
            },
            {
                name: 'format',
                type: 'string',
                description: 'Output format (default: json)',
                required: false,
                enum: ['json', 'text', 'mermaid', 'paths'],
            },
            {
                name: 'node',
                type: 'string',
                description: 'Focus on a specific node ID',
                required: false,
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Specific workflow if file has multiple',
                required: false,
            },
        ],
    },
    {
        name: 'fw_validate',
        description: 'Validate a workflow file and return errors/warnings.',
        category: 'query',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow file',
                required: true,
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Specific workflow name',
                required: false,
            },
        ],
    },
    {
        name: 'fw_compile',
        description: 'Compile a workflow to executable code.',
        category: 'query',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow file',
                required: true,
            },
            {
                name: 'write',
                type: 'boolean',
                description: 'Whether to write the output file (default: true)',
                required: false,
            },
            {
                name: 'production',
                type: 'boolean',
                description: 'Production mode — no debug events (default: false)',
                required: false,
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Specific workflow name',
                required: false,
            },
        ],
    },
    {
        name: 'fw_diff',
        description: 'Semantic diff between two workflow files — node type changes, instance changes, connection changes, breaking changes.',
        category: 'query',
        params: [
            {
                name: 'file1',
                type: 'string',
                description: 'Path to first workflow file',
                required: true,
            },
            {
                name: 'file2',
                type: 'string',
                description: 'Path to second workflow file',
                required: true,
            },
            {
                name: 'format',
                type: 'string',
                description: 'Output format (default: text)',
                required: false,
                enum: ['text', 'json', 'compact'],
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Specific workflow name',
                required: false,
            },
        ],
    },
    {
        name: 'fw_query',
        description: 'Query workflow structure: nodes, connections, deps, dependents, data-deps, execution-order, isolated, dead-ends, disconnected-outputs, node-types.',
        category: 'query',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow file',
                required: true,
            },
            {
                name: 'query',
                type: 'string',
                description: 'Query type',
                required: true,
                enum: [
                    'nodes',
                    'connections',
                    'deps',
                    'dependents',
                    'data-deps',
                    'execution-order',
                    'isolated',
                    'dead-ends',
                    'disconnected-outputs',
                    'node-types',
                ],
            },
            {
                name: 'nodeId',
                type: 'string',
                description: 'Required for deps/dependents. Optional filter for connections.',
                required: false,
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Specific workflow name',
                required: false,
            },
        ],
    },
    {
        name: 'fw_doctor',
        description: 'Check project environment and configuration for flow-weaver compatibility.',
        category: 'query',
        params: [
            {
                name: 'directory',
                type: 'string',
                description: 'Directory to check (default: cwd)',
                required: false,
            },
        ],
    },
    // Template tools (tools-template.ts)
    {
        name: 'fw_list_templates',
        description: 'List available scaffold templates for workflows and nodes.',
        category: 'template',
        params: [
            {
                name: 'type',
                type: 'string',
                description: 'Filter template type (default: all)',
                required: false,
                enum: ['workflow', 'node', 'all'],
            },
        ],
    },
    {
        name: 'fw_scaffold',
        description: 'Create a workflow or node from a template.',
        category: 'template',
        params: [
            {
                name: 'template',
                type: 'string',
                description: 'Template name (e.g. "sequential", "validator")',
                required: true,
            },
            {
                name: 'filePath',
                type: 'string',
                description: 'Output file path',
                required: true,
            },
            {
                name: 'name',
                type: 'string',
                description: 'Workflow/node function name',
                required: false,
            },
            {
                name: 'preview',
                type: 'boolean',
                description: 'Preview only — return generated code without writing (default: false)',
                required: false,
            },
            {
                name: 'config',
                type: 'object',
                description: 'Template configuration (e.g. { nodes: ["fetch", "parse"], input: "rawData" })',
                required: false,
            },
        ],
    },
    // Pattern tools (tools-pattern.ts)
    {
        name: 'fw_list_patterns',
        description: 'List reusable patterns defined in a file.',
        category: 'pattern',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to file containing patterns',
                required: true,
            },
        ],
    },
    {
        name: 'fw_apply_pattern',
        description: 'Apply a reusable pattern to a workflow file.',
        category: 'pattern',
        params: [
            {
                name: 'patternFile',
                type: 'string',
                description: 'Path to file containing the pattern',
                required: true,
            },
            {
                name: 'targetFile',
                type: 'string',
                description: 'Path to target workflow file',
                required: true,
            },
            {
                name: 'patternName',
                type: 'string',
                description: 'Specific pattern name if file has multiple',
                required: false,
            },
            {
                name: 'prefix',
                type: 'string',
                description: 'Node ID prefix to avoid conflicts',
                required: false,
            },
            {
                name: 'preview',
                type: 'boolean',
                description: "Preview only, don't write (default: false)",
                required: false,
            },
        ],
    },
    {
        name: 'fw_find_workflows',
        description: 'Scan a directory for workflow files containing @flowWeaver workflow annotations. Returns file paths and workflow metadata.',
        category: 'pattern',
        params: [
            {
                name: 'directory',
                type: 'string',
                description: 'Directory to search for workflow files',
                required: true,
            },
            {
                name: 'pattern',
                type: 'string',
                description: 'Glob pattern (default: **/*.ts)',
                required: false,
            },
        ],
    },
    {
        name: 'fw_extract_pattern',
        description: 'Extract a reusable pattern from selected nodes in a workflow. Identifies internal connections and boundary IN/OUT ports automatically.',
        category: 'pattern',
        params: [
            {
                name: 'sourceFile',
                type: 'string',
                description: 'Path to workflow file',
                required: true,
            },
            {
                name: 'nodes',
                type: 'string',
                description: 'Comma-separated node IDs to extract',
                required: true,
            },
            {
                name: 'name',
                type: 'string',
                description: 'Pattern name',
                required: false,
            },
            {
                name: 'outputFile',
                type: 'string',
                description: 'Output file path (omit for preview only)',
                required: false,
            },
        ],
    },
    // Modify tools (tools-pattern.ts - fw_modify, fw_modify_batch)
    {
        name: 'fw_modify',
        description: 'Modify a workflow file: add/remove/rename nodes, add/remove connections, set positions/labels. Parses the file, applies the mutation, and regenerates annotations in-place. Returns auto-validation results and a text description of the updated workflow.',
        category: 'modify',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow file',
                required: true,
            },
            {
                name: 'operation',
                type: 'string',
                description: 'The mutation to perform',
                required: true,
                enum: [
                    'addNode',
                    'removeNode',
                    'renameNode',
                    'addConnection',
                    'removeConnection',
                    'setNodePosition',
                    'setNodeLabel',
                ],
            },
            {
                name: 'params',
                type: 'object',
                description: 'Operation-specific parameters. addNode: {nodeId, nodeType, x?, y?}. removeNode: {nodeId}. renameNode: {oldId, newId}. addConnection/removeConnection: {from, to} ("node.port" format). setNodePosition: {nodeId, x, y}. setNodeLabel: {nodeId, label}.',
                required: true,
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Specific workflow if file has multiple',
                required: false,
            },
            {
                name: 'preview',
                type: 'boolean',
                description: 'Preview without writing (default: false)',
                required: false,
            },
        ],
    },
    {
        name: 'fw_modify_batch',
        description: 'Apply multiple modify operations in a single parse/write/validate cycle. More efficient than calling fw_modify multiple times.',
        category: 'modify',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow file',
                required: true,
            },
            {
                name: 'operations',
                type: 'array',
                description: 'Array of operations to apply sequentially. Each operation has { operation, params }.',
                required: true,
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Specific workflow if file has multiple',
                required: false,
            },
            {
                name: 'preview',
                type: 'boolean',
                description: 'Preview without writing (default: false)',
                required: false,
            },
        ],
    },
    // Export tools (tools-export.ts)
    {
        name: 'fw_export',
        description: 'Export workflows as serverless deployments. Generates handler code, platform config, and deploy instructions.',
        category: 'execution',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow file',
                required: true,
            },
            {
                name: 'target',
                type: 'string',
                description: 'Target deployment platform (provided by installed packs)',
                required: true,
            },
            {
                name: 'outputDir',
                type: 'string',
                description: 'Output directory for generated files',
                required: true,
            },
            {
                name: 'serviceName',
                type: 'string',
                description: 'Service name for the deployment',
                required: false,
            },
            {
                name: 'workflows',
                type: 'array',
                description: 'Specific workflows to export',
                required: false,
            },
            {
                name: 'nodeTypes',
                type: 'array',
                description: 'Node types to include',
                required: false,
            },
            {
                name: 'includeDocs',
                type: 'boolean',
                description: 'Include API documentation routes',
                required: false,
            },
            {
                name: 'preview',
                type: 'boolean',
                description: 'Preview without writing files (default: false)',
                required: false,
            },
        ],
    },
    // Debug tools (tools-debug.ts)
    {
        name: 'fw_debug_workflow',
        description: 'Start a step-through debug session for a workflow. Compiles and executes the workflow, pausing before the first node.',
        category: 'debug',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow .ts file',
                required: true,
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Specific workflow function name (for multi-workflow files)',
                required: false,
            },
            {
                name: 'params',
                type: 'object',
                description: 'Parameters to pass to the workflow',
                required: false,
            },
            {
                name: 'breakpoints',
                type: 'array',
                description: 'Node IDs to set as initial breakpoints',
                required: false,
            },
            {
                name: 'checkpoint',
                type: 'boolean',
                description: 'Enable checkpointing to disk after each node (default: false)',
                required: false,
            },
        ],
    },
    {
        name: 'fw_debug_step',
        description: 'Step to the next node in a debug session. Executes one node then pauses again.',
        category: 'debug',
        params: [
            {
                name: 'debugId',
                type: 'string',
                description: 'The debug session ID from fw_debug_workflow',
                required: true,
            },
        ],
    },
    {
        name: 'fw_debug_continue',
        description: 'Continue execution from the current pause point. Runs to completion, or stops at the next breakpoint if toBreakpoint is true.',
        category: 'debug',
        params: [
            {
                name: 'debugId',
                type: 'string',
                description: 'The debug session ID',
                required: true,
            },
            {
                name: 'toBreakpoint',
                type: 'boolean',
                description: 'If true, pause at the next breakpoint instead of running to completion',
                required: false,
            },
        ],
    },
    {
        name: 'fw_debug_inspect',
        description: 'Inspect the current debug state without advancing execution. Returns all variables, or filter to a specific node.',
        category: 'debug',
        params: [
            {
                name: 'debugId',
                type: 'string',
                description: 'The debug session ID',
                required: true,
            },
            {
                name: 'nodeId',
                type: 'string',
                description: "Filter to show only this node's variables",
                required: false,
            },
        ],
    },
    {
        name: 'fw_debug_set_variable',
        description: 'Modify a variable value in the debug session. The new value will be used by downstream nodes when execution continues.',
        category: 'debug',
        params: [
            {
                name: 'debugId',
                type: 'string',
                description: 'The debug session ID',
                required: true,
            },
            {
                name: 'nodeId',
                type: 'string',
                description: 'The node that produced the variable',
                required: true,
            },
            {
                name: 'portName',
                type: 'string',
                description: 'The output port name',
                required: true,
            },
            {
                name: 'value',
                type: 'object',
                description: 'The new value to set (any JSON-compatible value)',
                required: true,
            },
            {
                name: 'executionIndex',
                type: 'number',
                description: 'Execution index (defaults to the latest)',
                required: false,
            },
        ],
    },
    {
        name: 'fw_debug_breakpoint',
        description: 'Add, remove, or list breakpoints in a debug session.',
        category: 'debug',
        params: [
            {
                name: 'debugId',
                type: 'string',
                description: 'The debug session ID',
                required: true,
            },
            {
                name: 'action',
                type: 'string',
                description: 'Action to perform',
                required: true,
                enum: ['add', 'remove', 'list'],
            },
            {
                name: 'nodeId',
                type: 'string',
                description: 'Node ID for add/remove',
                required: false,
            },
        ],
    },
    {
        name: 'fw_resume_from_checkpoint',
        description: 'Resume a workflow from a checkpoint file written after a crash. Skips completed nodes and re-runs from the last checkpoint position.',
        category: 'debug',
        params: [
            {
                name: 'filePath',
                type: 'string',
                description: 'Path to the workflow .ts file',
                required: true,
            },
            {
                name: 'checkpointFile',
                type: 'string',
                description: 'Path to the checkpoint file. If omitted, auto-detects the latest.',
                required: false,
            },
            {
                name: 'workflowName',
                type: 'string',
                description: 'Workflow function name (for multi-workflow files)',
                required: false,
            },
            {
                name: 'debug',
                type: 'boolean',
                description: 'Enter step-through debug mode at the resume point (default: false)',
                required: false,
            },
        ],
    },
    {
        name: 'fw_list_debug_sessions',
        description: 'List all active debug sessions.',
        category: 'debug',
        params: [],
    },
    // Context tools (tools-context.ts)
    {
        name: 'fw_context',
        description: 'Generate a self-contained LLM context bundle with Flow Weaver documentation, grammar, and conventions.',
        category: 'query',
        params: [
            {
                name: 'preset',
                type: 'string',
                description: 'Topic preset: core, authoring, full, or ops',
                required: false,
                enum: ['core', 'authoring', 'full', 'ops'],
            },
            {
                name: 'profile',
                type: 'string',
                description: 'Output profile: standalone (full dump) or assistant (assumes MCP tools)',
                required: false,
                enum: ['standalone', 'assistant'],
            },
            {
                name: 'topics',
                type: 'string',
                description: 'Comma-separated topic slugs (overrides preset)',
                required: false,
            },
            {
                name: 'addTopics',
                type: 'string',
                description: 'Comma-separated slugs to add to preset',
                required: false,
            },
            {
                name: 'includeGrammar',
                type: 'boolean',
                description: 'Include EBNF annotation grammar section (default: true)',
                required: false,
            },
        ],
    },
];
/**
 * Extract MCP tool documentation
 */
export function extractMcpTools() {
    return MCP_TOOLS;
}
//# sourceMappingURL=mcp-tools.js.map