// Tool definitions for session-mcp // Forked from task-mcp (CF-762): Removed task/epic/version/search/relations tools // Those are now handled by Jira Cloud via mcp-atlassian export const toolDefinitions = [ // Delegation Tools (kept for tracking code generation jobs) { name: 'task_delegations', description: 'List delegations for a specific Jira issue (quality scores, backends, status)', inputSchema: { type: 'object', properties: { task_id: { type: 'string', description: 'Jira issue key (e.g., CF-123)' }, }, required: ['task_id'], }, }, { name: 'task_delegation_query', description: 'Query delegations across tasks (filter by status, backend)', inputSchema: { type: 'object', properties: { status: { type: 'string', enum: ['pending', 'success', 'failed', 'partial'], description: 'Filter by delegation status' }, backend: { type: 'string', description: 'Filter by backend (e.g., grok, haiku)' }, limit: { type: 'number', description: 'Max results (default: 20)' }, }, }, }, // Commit Tools (kept for git-session linking) { name: 'task_commit_add', description: 'Link a git commit to a Jira issue key (SHA reference only)', inputSchema: { type: 'object', properties: { task_id: { type: 'string', description: 'Jira issue key (e.g., CF-123)' }, commit_sha: { type: 'string', description: 'Git commit SHA (full or short)' }, repo: { type: 'string', description: 'Repository (e.g., christian/VPN)' }, source: { type: 'string', enum: ['manual', 'parsed', 'pr_merge'], description: 'How the link was created (default: manual)' }, }, required: ['task_id', 'commit_sha', 'repo'], }, }, { name: 'task_commit_remove', description: 'Remove a commit link from a Jira issue', inputSchema: { type: 'object', properties: { task_id: { type: 'string', description: 'Jira issue key' }, commit_sha: { type: 'string', description: 'Commit SHA to unlink' }, }, required: ['task_id', 'commit_sha'], }, }, { name: 'task_commits_list', description: 'List commits linked to a Jira issue', inputSchema: { type: 'object', properties: { task_id: { type: 'string', description: 'Jira issue key' }, }, required: ['task_id'], }, }, { name: 'task_link_commits', description: 'Parse commit messages for Jira issue references and create links (batch operation)', inputSchema: { type: 'object', properties: { repo: { type: 'string', description: 'Repository (e.g., christian/VPN)' }, commits: { type: 'array', description: 'Array of commits with sha and message', items: { type: 'object', properties: { sha: { type: 'string' }, message: { type: 'string' }, }, required: ['sha', 'message'], }, }, dry_run: { type: 'boolean', description: 'Preview without creating links (default: false)' }, }, required: ['repo', 'commits'], }, }, { name: 'session_tasks', description: 'List Jira issues worked on in a session (from task_activity tracking)', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID (supports * wildcard)' }, limit: { type: 'number', description: 'Max results (default: 20)' }, }, required: ['session_id'], }, }, // Infrastructure Changelog Tools { name: 'changelog_add', description: 'Add infrastructure change entry for session awareness', inputSchema: { type: 'object', properties: { date: { type: 'string', description: 'Change date (YYYY-MM-DD)' }, title: { type: 'string', description: 'Short title (max 100 chars)' }, change_description: { type: 'string', description: 'What changed' }, impact: { type: 'string', description: 'Effects on existing infrastructure' }, actions_required: { type: 'string', description: 'Steps developers need to take (optional)' }, session_id: { type: 'string', description: 'Session that implemented change (optional)' }, task_ids: { type: 'array', items: { type: 'string' }, description: 'Related Jira issue keys (optional)' }, }, required: ['date', 'title', 'change_description', 'impact'], }, }, { name: 'changelog_since_session', description: 'Get infrastructure changes since last session for a project. Use at session start.', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key (e.g., CF, VPN) to find last session' }, }, required: ['project'], }, }, { name: 'changelog_list', description: 'List recent infrastructure changes by time period', inputSchema: { type: 'object', properties: { days_back: { type: 'number', description: 'Days to look back (default: 7)' }, limit: { type: 'number', description: 'Max results (default: 20)' }, }, }, }, // Project Lock Tools { name: 'project_lock', description: 'Lock a project for exclusive session access.', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key (e.g., VPN, ST)' }, session_id: { type: 'string', description: 'Unique session identifier' }, duration_minutes: { type: 'number', description: 'Lock duration in minutes (default: 120)' }, reason: { type: 'string', description: 'Optional reason for locking' }, }, required: ['project', 'session_id'], }, }, { name: 'project_unlock', description: 'Release a project lock', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key to unlock' }, session_id: { type: 'string', description: 'Session ID (must match lock owner unless force=true)' }, force: { type: 'boolean', description: 'Force unlock even if owned by different session' }, }, required: ['project'], }, }, { name: 'project_lock_status', description: 'Check lock status for a project or all projects', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key (optional, shows all if omitted)' }, }, }, }, { name: 'project_context', description: 'Get project context from current directory - returns detected project, lock status, recent sessions.', inputSchema: { type: 'object', properties: {}, }, }, // Impact Analysis Tools { name: 'component_register', description: 'Register a system component for impact analysis tracking', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Unique component ID' }, name: { type: 'string', description: 'Human-readable name' }, type: { type: 'string', enum: ['service', 'script', 'config', 'database', 'api', 'ui', 'library'], description: 'Component type' }, path: { type: 'string', description: 'File system path or Docker container name' }, repo: { type: 'string', description: 'Git repository' }, description: { type: 'string', description: 'What this component does' }, health_check: { type: 'string', description: 'Command or URL to check health' }, }, required: ['id', 'name', 'type'], }, }, { name: 'component_list', description: 'List registered components, optionally filtered by type', inputSchema: { type: 'object', properties: { type: { type: 'string', enum: ['service', 'script', 'config', 'database', 'api', 'ui', 'library'], description: 'Filter by component type' }, }, }, }, { name: 'component_add_dependency', description: 'Add a dependency between two components', inputSchema: { type: 'object', properties: { component_id: { type: 'string', description: 'Source component ID' }, depends_on: { type: 'string', description: 'Target component ID' }, dependency_type: { type: 'string', enum: ['hard', 'soft', 'config', 'data'], description: 'Type of dependency' }, description: { type: 'string', description: 'Description of the dependency' }, }, required: ['component_id', 'depends_on', 'dependency_type'], }, }, { name: 'component_add_file', description: 'Map a file pattern to a component (for git diff analysis)', inputSchema: { type: 'object', properties: { component_id: { type: 'string', description: 'Component ID' }, file_pattern: { type: 'string', description: 'File pattern (e.g., src/services/*.py)' }, }, required: ['component_id', 'file_pattern'], }, }, { name: 'component_add_check', description: 'Add a verification check to a component', inputSchema: { type: 'object', properties: { component_id: { type: 'string', description: 'Component ID' }, name: { type: 'string', description: 'Check name' }, check_type: { type: 'string', enum: ['command', 'http', 'tcp', 'file'], description: 'Type of check' }, check_command: { type: 'string', description: 'Command/URL to execute' }, expected_result: { type: 'string', description: 'Expected output or status' }, timeout_seconds: { type: 'number', description: 'Timeout in seconds (default: 30)' }, }, required: ['component_id', 'name', 'check_type', 'check_command'], }, }, { name: 'impact_analysis', description: 'Analyze which components are affected by file changes', inputSchema: { type: 'object', properties: { changed_files: { type: 'array', items: { type: 'string' }, description: 'List of changed file paths' }, }, required: ['changed_files'], }, }, { name: 'impact_learn', description: 'Record a learned impact relationship', inputSchema: { type: 'object', properties: { changed_component: { type: 'string', description: 'Component that was changed' }, affected_component: { type: 'string', description: 'Component that was unexpectedly affected' }, impact_description: { type: 'string', description: 'What went wrong' }, error_id: { type: 'string', description: 'Related error ID' }, task_id: { type: 'string', description: 'Related Jira issue key' }, }, required: ['changed_component', 'affected_component', 'impact_description'], }, }, { name: 'component_graph', description: 'Get component dependency graph', inputSchema: { type: 'object', properties: { component_id: { type: 'string', description: 'Center component (optional, shows all if omitted)' }, }, }, }, // Memory Tools { name: 'memory_add', description: 'Store a learning/memory for future sessions.', inputSchema: { type: 'object', properties: { category: { type: 'string', enum: ['pattern', 'fix', 'preference', 'gotcha', 'architecture'], description: 'Memory category' }, title: { type: 'string', description: 'Short title' }, content: { type: 'string', description: 'The learning/insight to remember' }, context: { type: 'string', description: 'When/where this applies (optional)' }, project: { type: 'string', description: 'Project (optional)' }, session_id: { type: 'string', description: 'Session ID (optional)' }, task_id: { type: 'string', description: 'Jira issue key (optional)' }, }, required: ['category', 'title', 'content'], }, }, { name: 'memory_search', description: 'Search memories semantically.', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query' }, project: { type: 'string', description: 'Filter by project (optional)' }, category: { type: 'string', enum: ['pattern', 'fix', 'preference', 'gotcha', 'architecture'], description: 'Filter by category (optional)' }, limit: { type: 'number', description: 'Max results (default: 5)' }, }, required: ['query'], }, }, { name: 'memory_list', description: 'List stored memories (non-semantic)', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Filter by project (optional)' }, category: { type: 'string', enum: ['pattern', 'fix', 'preference', 'gotcha', 'architecture'], description: 'Filter by category (optional)' }, limit: { type: 'number', description: 'Max results (default: 20)' }, }, }, }, { name: 'memory_context', description: 'Get memories relevant to current session context.', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Current project' }, task_description: { type: 'string', description: 'Description of planned work' }, }, }, }, // Tool Documentation Tools { name: 'tool_doc_add', description: 'Add a new tool documentation entry', inputSchema: { type: 'object', properties: { tool_name: { type: 'string', description: 'Tool or command name' }, category: { type: 'string', enum: ['mcp', 'cli', 'script', 'internal', 'deprecated'], description: 'Tool category' }, title: { type: 'string', description: 'Short descriptive title' }, description: { type: 'string', description: 'Detailed description' }, usage_example: { type: 'string', description: 'Usage example (optional)' }, parameters: { type: 'object', description: 'Parameter definitions (optional)' }, notes: { type: 'string', description: 'Additional notes (optional)' }, tags: { type: 'array', items: { type: 'string' }, description: 'Searchable tags (optional)' }, source_file: { type: 'string', description: 'Original source file (optional)' }, }, required: ['tool_name', 'category', 'title', 'description'], }, }, { name: 'tool_doc_search', description: 'Search tool documentation semantically', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query' }, category: { type: 'string', enum: ['mcp', 'cli', 'script', 'internal', 'deprecated'], description: 'Filter by category (optional)' }, tags: { type: 'array', items: { type: 'string' }, description: 'Filter by tags (optional)' }, limit: { type: 'number', description: 'Max results (default: 5)' }, }, required: ['query'], }, }, { name: 'tool_doc_get', description: 'Get specific tool documentation by name', inputSchema: { type: 'object', properties: { tool_name: { type: 'string', description: 'Tool or command name' }, }, required: ['tool_name'], }, }, { name: 'tool_doc_list', description: 'List tool documentation entries', inputSchema: { type: 'object', properties: { category: { type: 'string', enum: ['mcp', 'cli', 'script', 'internal', 'deprecated'], description: 'Filter by category (optional)' }, tag: { type: 'string', description: 'Filter by tag (optional)' }, limit: { type: 'number', description: 'Max results (default: 20)' }, }, }, }, { name: 'tool_doc_export', description: 'Export all tool documentation as markdown', inputSchema: { type: 'object', properties: {}, }, }, // Session Management Tools { name: 'session_start', description: 'Start a new session with metadata tracking. Links to Jira issue key.', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID (auto-generated if not provided)' }, project: { type: 'string', description: 'Project key (e.g., CF, VPN)' }, jira_issue_key: { type: 'string', description: 'Jira issue key being worked on (e.g., CF-123)' }, working_directory: { type: 'string', description: 'Current working directory' }, git_branch: { type: 'string', description: 'Current git branch' }, initial_prompt: { type: 'string', description: 'First user message' }, }, required: ['project'], }, }, { name: 'session_update', description: 'Update session metrics (message count, tokens, tools used)', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID to update' }, message_count: { type: 'number', description: 'Number of messages exchanged' }, token_count: { type: 'number', description: 'Total tokens used' }, tools_used: { type: 'array', items: { type: 'string' }, description: 'Array of tool names used' }, }, required: ['session_id'], }, }, { name: 'session_end', description: 'End session and generate summary with embedding', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID to end' }, summary: { type: 'string', description: 'Session summary text' }, status: { type: 'string', enum: ['completed', 'interrupted'], description: 'Session completion status (default: completed)' }, }, required: ['session_id', 'summary'], }, }, { name: 'session_list', description: 'List sessions with filtering and pagination', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Filter by project key' }, status: { type: 'string', enum: ['active', 'completed', 'interrupted'], description: 'Filter by status' }, since: { type: 'string', description: 'Show sessions since date (ISO format)' }, limit: { type: 'number', description: 'Max results (default: 20)' }, }, }, }, { name: 'session_search', description: 'Find similar sessions using vector search', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query' }, project: { type: 'string', description: 'Filter by project (optional)' }, limit: { type: 'number', description: 'Max results (default: 5)' }, }, required: ['query'], }, }, { name: 'session_context', description: 'Get complete context: Jira issues, commits, builds, memories', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID to get context for' }, }, required: ['session_id'], }, }, { name: 'build_record', description: 'Record build information linked to session', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID (optional)' }, version_id: { type: 'string', description: 'Version ID being built' }, build_number: { type: 'number', description: 'Build number' }, git_commit_sha: { type: 'string', description: 'Git commit SHA' }, status: { type: 'string', description: 'Build status (pending, running, success, failed)' }, started_at: { type: 'string', description: 'Build start timestamp (ISO format)' }, }, required: ['version_id', 'build_number', 'status', 'started_at'], }, }, { name: 'session_commit_link', description: 'Link a commit to a session', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID' }, commit_sha: { type: 'string', description: 'Git commit SHA' }, repo: { type: 'string', description: 'Repository' }, commit_message: { type: 'string', description: 'Commit message (optional)' }, committed_at: { type: 'string', description: 'Commit timestamp (ISO format, optional)' }, }, required: ['session_id', 'commit_sha', 'repo'], }, }, { name: 'session_recover_orphaned', description: 'Recover abandoned/orphaned sessions (active >2 hours)', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key to filter by (optional)' }, }, }, }, { name: 'session_recover_temp_notes', description: 'Recover notes from temp files for a specific session', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID to recover notes for' }, temp_file_path: { type: 'string', description: 'Path to .claude-session/*/notes.md file' }, }, required: ['session_id', 'temp_file_path'], }, }, // Session Documentation Tools { name: 'session_note_add', description: 'Add a note to current session with auto-generated embedding', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID' }, note_type: { type: 'string', enum: ['accomplishment', 'decision', 'gotcha', 'next_steps', 'context'], description: 'Category of note' }, content: { type: 'string', description: 'Note content' }, }, required: ['session_id', 'note_type', 'content'], }, }, { name: 'session_notes_list', description: 'List all notes for a session', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID' }, note_type: { type: 'string', enum: ['accomplishment', 'decision', 'gotcha', 'next_steps', 'context'], description: 'Filter by note type (optional)' }, }, required: ['session_id'], }, }, { name: 'session_plan_save', description: 'Save a plan to database with semantic embedding', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID' }, plan_content: { type: 'string', description: 'Plan content in markdown' }, plan_file_name: { type: 'string', description: 'Original filename (optional)' }, status: { type: 'string', enum: ['draft', 'approved', 'executed', 'abandoned'], description: 'Plan status (default: draft)' }, }, required: ['session_id', 'plan_content'], }, }, { name: 'session_plan_update_status', description: 'Update plan status (draft → approved → executed)', inputSchema: { type: 'object', properties: { plan_id: { type: 'number', description: 'Plan ID to update' }, status: { type: 'string', enum: ['draft', 'approved', 'executed', 'abandoned'], description: 'New status' }, }, required: ['plan_id', 'status'], }, }, { name: 'session_plan_list', description: 'List plans for a session', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID' }, status: { type: 'string', enum: ['draft', 'approved', 'executed', 'abandoned'], description: 'Filter by status (optional)' }, }, required: ['session_id'], }, }, { name: 'project_doc_upsert', description: 'Create or update project documentation', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key' }, doc_type: { type: 'string', enum: ['overview', 'architecture', 'guidelines', 'history', 'configuration', 'workflow'], description: 'Documentation type' }, title: { type: 'string', description: 'Document title' }, content: { type: 'string', description: 'Document content in markdown' }, session_id: { type: 'string', description: 'Session ID (optional)' }, }, required: ['project', 'doc_type', 'title', 'content'], }, }, { name: 'project_doc_get', description: 'Get specific project documentation by type', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key' }, doc_type: { type: 'string', enum: ['overview', 'architecture', 'guidelines', 'history', 'configuration', 'workflow'], description: 'Documentation type' }, }, required: ['project', 'doc_type'], }, }, { name: 'project_doc_list', description: 'List all documentation for a project', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key' }, }, required: ['project'], }, }, { name: 'session_documentation_generate', description: 'Auto-generate full markdown documentation for a session', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID' }, }, required: ['session_id'], }, }, { name: 'session_semantic_search', description: 'Semantic search across all session documentation', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query' }, project: { type: 'string', description: 'Filter by project (optional)' }, limit: { type: 'number', description: 'Max results (default: 10)' }, }, required: ['query'], }, }, { name: 'session_productivity_analytics', description: 'Get productivity metrics', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Filter by project (optional)' }, time_period: { type: 'string', enum: ['week', 'month', 'quarter'], description: 'Time period (default: month)' }, }, }, }, { name: 'session_pattern_detection', description: 'Detect patterns across sessions', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Filter by project (optional)' }, pattern_type: { type: 'string', enum: ['tool_usage', 'task_types', 'error_frequency'], description: 'Type of pattern to detect' }, }, }, }, // Archive Tools { name: 'archive_add', description: 'Archive content to database with semantic embedding.', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Project key' }, archive_type: { type: 'string', enum: ['session', 'research', 'audit', 'investigation', 'completed', 'migration'], description: 'Archive type' }, title: { type: 'string', description: 'Archive title' }, content: { type: 'string', description: 'Archive content (markdown)' }, original_path: { type: 'string', description: 'Original file path (optional)' }, file_size: { type: 'number', description: 'File size in bytes (optional)' }, archived_by_session: { type: 'string', description: 'Session ID (optional)' }, metadata: { type: 'object', description: 'Additional metadata (optional)' }, }, required: ['project', 'archive_type', 'title', 'content'], }, }, { name: 'archive_search', description: 'Search archives using semantic similarity', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query' }, project: { type: 'string', description: 'Filter by project (optional)' }, archive_type: { type: 'string', enum: ['session', 'research', 'audit', 'investigation', 'completed', 'migration'], description: 'Filter by archive type (optional)' }, limit: { type: 'number', description: 'Max results (default: 5)' }, }, required: ['query'], }, }, { name: 'archive_list', description: 'List archives with optional filters', inputSchema: { type: 'object', properties: { project: { type: 'string', description: 'Filter by project (optional)' }, archive_type: { type: 'string', enum: ['session', 'research', 'audit', 'investigation', 'completed', 'migration'], description: 'Filter by archive type (optional)' }, since: { type: 'string', description: 'Show archives since date (ISO format, optional)' }, limit: { type: 'number', description: 'Max results (default: 20)' }, }, }, }, { name: 'archive_get', description: 'Get full content of specific archive by ID', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Archive ID' }, }, required: ['id'], }, }, // Project Archival { name: 'project_archive', description: 'Archive complete project to S3 with database tracking.', inputSchema: { type: 'object', properties: { project_key: { type: 'string', description: 'Project key' }, project_path: { type: 'string', description: 'Absolute path to project directory' }, delete_local: { type: 'boolean', description: 'Delete local project after successful archive (default: false)' }, session_id: { type: 'string', description: 'Session ID performing the archival (optional)' }, }, required: ['project_key', 'project_path'], }, }, ];