Files
session-mcp/src/tools/index.ts
Christian Gick 6cbb5ce6cb feat(CF-314): Add planning_mode_required field and smart planning mode support
Adds DB column, TypeScript types, MCP tool schemas, and CRUD handlers
for planning_mode_required (NULL=auto-detect, true=always, false=never).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 20:30:36 +02:00

1114 lines
42 KiB
TypeScript

// Tool definitions for task-mcp
export const toolDefinitions = [
// CRUD Tools
{
name: 'task_add',
description: 'Create a new task with auto-generated ID and semantic embedding',
inputSchema: {
type: 'object',
properties: {
title: { type: 'string', description: 'Task title (required)' },
project: { type: 'string', description: 'Project key (e.g., ST, VPN). Auto-detected from CWD if not provided.' },
type: { type: 'string', enum: ['task', 'bug', 'feature', 'debt', 'investigation'], description: 'Task type (default: task)' },
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'], description: 'Priority level (default: P2)' },
description: { type: 'string', description: 'Optional description' },
planning_mode_required: { type: 'boolean', description: 'Override planning mode: true=always plan, false=never plan, omit=auto-detect' },
},
required: ['title'],
},
},
{
name: 'task_list',
description: 'List tasks with optional filters',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Filter by project key' },
status: { type: 'string', enum: ['open', 'in_progress', 'testing', 'blocked', 'completed'], description: 'Filter by exact status value. IMPORTANT: "open" only matches status=open, NOT in_progress/blocked/testing. Omit this parameter entirely to show ALL non-completed tasks.' },
type: { type: 'string', enum: ['task', 'bug', 'feature', 'debt', 'investigation'], description: 'Filter by type' },
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'], description: 'Filter by priority' },
limit: { type: 'number', description: 'Max results (default: 20)' },
},
},
},
{
name: 'task_show',
description: 'Show task details including checklist and dependencies',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Task ID (e.g., ST-1, VPN-45)' },
},
required: ['id'],
},
},
{
name: 'task_close',
description: 'Mark a task as completed',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Task ID to close' },
},
required: ['id'],
},
},
{
name: 'task_update',
description: 'Update task fields (status, priority, type, title)',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Task ID to update' },
status: { type: 'string', enum: ['open', 'in_progress', 'testing', 'blocked', 'completed'], description: 'New status' },
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'], description: 'New priority' },
type: { type: 'string', enum: ['task', 'bug', 'feature', 'debt', 'investigation'], description: 'New type' },
title: { type: 'string', description: 'New title' },
planning_mode_required: { type: 'boolean', description: 'Override planning mode: true=always plan, false=never plan, null=auto-detect' },
},
required: ['id'],
},
},
{
name: 'task_investigate',
description: 'Start an investigation workflow: creates an investigation task and auto-links all subsequent tasks to it. Use when beginning multi-step problem analysis.',
inputSchema: {
type: 'object',
properties: {
title: { type: 'string', description: 'Investigation title (required)' },
project: { type: 'string', description: 'Project key (e.g., ST, VPN). Auto-detected from CWD if not provided.' },
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'], description: 'Priority level (default: P1)' },
description: { type: 'string', description: 'Optional description of investigation scope' },
},
required: ['title'],
},
},
{
name: 'task_move_project',
description: 'Move task to different project while preserving history',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Task ID to move (e.g., CF-295)' },
target_project: { type: 'string', description: 'Target project key (e.g., VPN, ST, GB)' },
reason: { type: 'string', description: 'Optional reason for move' },
},
required: ['id', 'target_project'],
},
},
// Semantic Search Tools
{
name: 'task_similar',
description: 'Find semantically similar tasks using pgvector',
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: 'task_context',
description: 'Get related tasks for current work context (useful for delegations)',
inputSchema: {
type: 'object',
properties: {
description: { type: 'string', description: 'Description of current work' },
project: { type: 'string', description: 'Current project' },
limit: { type: 'number', description: 'Max related tasks (default: 3)' },
},
required: ['description'],
},
},
{
name: 'task_session_context',
description: 'Get session context for a task - retrieves notes, decisions, and related tasks from the session where the task was created. Use this to understand the original context and requirements.',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Task ID (e.g., CF-570)' },
},
required: ['id'],
},
},
// Relation Tools
{
name: 'task_link',
description: 'Create dependency between tasks',
inputSchema: {
type: 'object',
properties: {
from_id: { type: 'string', description: 'Source task ID' },
to_id: { type: 'string', description: 'Target task ID' },
link_type: { type: 'string', enum: ['blocks', 'relates_to', 'duplicates', 'depends_on', 'needs', 'implements', 'fixes', 'causes', 'subtask_of'], description: 'Relationship type' },
},
required: ['from_id', 'to_id', 'link_type'],
},
},
{
name: 'task_checklist_add',
description: 'Add a checklist item to a task',
inputSchema: {
type: 'object',
properties: {
task_id: { type: 'string', description: 'Task ID' },
item: { type: 'string', description: 'Checklist item text' },
},
required: ['task_id', 'item'],
},
},
{
name: 'task_checklist_toggle',
description: 'Toggle a checklist item (check/uncheck)',
inputSchema: {
type: 'object',
properties: {
item_id: { type: 'number', description: 'Checklist item ID' },
checked: { type: 'boolean', description: 'New checked state' },
},
required: ['item_id', 'checked'],
},
},
{
name: 'task_resolve_duplicate',
description: 'Resolve a duplicate issue by closing it and linking to the dominant issue',
inputSchema: {
type: 'object',
properties: {
duplicate_id: { type: 'string', description: 'The duplicate task ID to close' },
dominant_id: { type: 'string', description: 'The dominant/original task ID to keep' },
},
required: ['duplicate_id', 'dominant_id'],
},
},
// Epic Tools
{
name: 'epic_add',
description: 'Create a new epic (session-scoped work bundle) with auto-generated ID',
inputSchema: {
type: 'object',
properties: {
title: { type: 'string', description: 'Epic title (required)' },
project: { type: 'string', description: 'Project key (e.g., VPN, ST). Auto-detected if not provided.' },
description: { type: 'string', description: 'Optional description of the epic scope' },
},
required: ['title'],
},
},
{
name: 'epic_list',
description: 'List epics with task counts and progress',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Filter by project key' },
status: { type: 'string', enum: ['open', 'in_progress', 'completed'], description: 'Filter by status' },
limit: { type: 'number', description: 'Max results (default: 20)' },
},
},
},
{
name: 'epic_show',
description: 'Show epic details with all assigned tasks',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Epic ID (e.g., VPN-E1, ST-E3)' },
},
required: ['id'],
},
},
{
name: 'epic_assign',
description: 'Assign a task to an epic',
inputSchema: {
type: 'object',
properties: {
task_id: { type: 'string', description: 'Task ID to assign' },
epic_id: { type: 'string', description: 'Epic ID to assign to' },
},
required: ['task_id', 'epic_id'],
},
},
{
name: 'epic_close',
description: 'Close an epic (mark as completed)',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Epic ID to close (e.g., VPN-E1, ST-E3)' },
},
required: ['id'],
},
},
// Version Tools
{
name: 'version_add',
description: 'Create a new version/release for a project',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key (e.g., VPN, ST)' },
version: { type: 'string', description: 'Version number (e.g., 1.0.0, 2.1.0-beta)' },
build_number: { type: 'number', description: 'Optional build number' },
status: { type: 'string', enum: ['planned', 'in_progress', 'released', 'archived'], description: 'Version status (default: planned)' },
release_notes: { type: 'string', description: 'Optional release notes' },
},
required: ['project', 'version'],
},
},
{
name: 'version_list',
description: 'List versions with optional filters',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Filter by project key' },
status: { type: 'string', enum: ['planned', 'in_progress', 'released', 'archived'], description: 'Filter by status' },
limit: { type: 'number', description: 'Max results (default: 20)' },
},
},
},
{
name: 'version_show',
description: 'Show version details with assigned tasks and epics',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Version ID (e.g., VPN-v1.0.0)' },
},
required: ['id'],
},
},
{
name: 'version_update',
description: 'Update version fields (status, git_tag, git_sha, release_notes)',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Version ID to update' },
status: { type: 'string', enum: ['planned', 'in_progress', 'released', 'archived'], description: 'New status' },
git_tag: { type: 'string', description: 'Git tag name (e.g., v1.0.0)' },
git_sha: { type: 'string', description: 'Git commit SHA for this version' },
release_notes: { type: 'string', description: 'Release notes' },
release_date: { type: 'string', description: 'Release date (ISO format)' },
},
required: ['id'],
},
},
{
name: 'version_release',
description: 'Mark a version as released (sets status and release_date)',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Version ID to release' },
git_tag: { type: 'string', description: 'Optional git tag to associate' },
},
required: ['id'],
},
},
{
name: 'version_assign_task',
description: 'Assign a task to a version',
inputSchema: {
type: 'object',
properties: {
task_id: { type: 'string', description: 'Task ID to assign' },
version_id: { type: 'string', description: 'Version ID to assign to' },
},
required: ['task_id', 'version_id'],
},
},
// Delegation Tools
{
name: 'task_delegations',
description: 'List delegations for a specific task (quality scores, backends, status)',
inputSchema: {
type: 'object',
properties: {
task_id: { type: 'string', description: 'Task ID (e.g., ST-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
{
name: 'task_commit_add',
description: 'Link a git commit to a task (SHA reference only, Gitea MCP has full commit data)',
inputSchema: {
type: 'object',
properties: {
task_id: { type: 'string', description: 'Task ID (e.g., VPN-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 task',
inputSchema: {
type: 'object',
properties: {
task_id: { type: 'string', description: 'Task ID' },
commit_sha: { type: 'string', description: 'Commit SHA to unlink' },
},
required: ['task_id', 'commit_sha'],
},
},
{
name: 'task_commits_list',
description: 'List commits linked to a task',
inputSchema: {
type: 'object',
properties: {
task_id: { type: 'string', description: 'Task ID' },
},
required: ['task_id'],
},
},
{
name: 'task_link_commits',
description: 'Parse commit messages for task 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 tasks worked on in a session (from task_activity tracking)',
inputSchema: {
type: 'object',
properties: {
session_id: { type: 'string', description: 'Session ID (supports * wildcard, e.g., session_20260110_*)' },
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 task IDs (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 (fallback)',
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. Prevents other sessions from working on it.',
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, open tasks, epics, and lock status. Use at session start.',
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 (e.g., propertymap-scraper, gridbot-conductor)' },
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 (e.g., christian/propertymap)' },
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 (what source depends on)' },
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, docker-compose.yml)' },
},
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 (e.g., health-endpoint, container-running)' },
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 (when we discover a missed dependency)',
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 from error memory' },
task_id: { type: 'string', description: 'Related task ID' },
},
required: ['changed_component', 'affected_component', 'impact_description'],
},
},
{
name: 'component_graph',
description: 'Get component dependency graph (for visualization)',
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. Use at session end to persist insights.',
inputSchema: {
type: 'object',
properties: {
category: { type: 'string', enum: ['pattern', 'fix', 'preference', 'gotcha', 'architecture'], description: 'Memory category' },
title: { type: 'string', description: 'Short title for the memory' },
content: { type: 'string', description: 'The learning/insight to remember' },
context: { type: 'string', description: 'When/where this applies (optional)' },
project: { type: 'string', description: 'Project this relates to (optional)' },
session_id: { type: 'string', description: 'Session ID to link memory to (optional)' },
task_id: { type: 'string', description: 'Task ID to link memory to (optional)' },
},
required: ['category', 'title', 'content'],
},
},
{
name: 'memory_search',
description: 'Search memories semantically. Returns relevant learnings for current context.',
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. Use at session start.',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Current project' },
task_description: { type: 'string', description: 'Description of planned work (for semantic matching)' },
},
},
},
// 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 of what the tool does' },
usage_example: { type: 'string', description: 'Usage example (optional)' },
parameters: { type: 'object', description: 'Parameter definitions (optional)' },
notes: { type: 'string', description: 'Additional notes, gotchas, tips (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 (for backup/migration)',
inputSchema: {
type: 'object',
properties: {},
},
},
// Session Management Tools
{
name: 'session_start',
description: 'Start a new session with metadata tracking',
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)' },
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: tasks, 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 and version',
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 (automatically called when commits are made)',
inputSchema: {
type: 'object',
properties: {
session_id: { type: 'string', description: 'Session ID' },
commit_sha: { type: 'string', description: 'Git commit SHA' },
repo: { type: 'string', description: 'Repository (e.g., christian/ClaudeFramework)' },
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 (CF-572). Detects sessions active for >2 hours and marks as abandoned',
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 (CF-572)',
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, optionally filtered by type',
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 (e.g., eloquent-yellow-cat.md) - 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 (replaces CLAUDE.md sections)',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key (e.g., CF, VPN)' },
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 (tasks, commits, notes, plans)',
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 using vector similarity',
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 (avg duration, tasks/commits per session, etc.)',
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 (tool usage, task types)',
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 (default: tool_usage)' },
},
},
},
// Archive Tools
{
name: 'archive_add',
description: 'Archive content to database with semantic embedding. Replaces filesystem archives.',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Project key (e.g., CF, VPN)' },
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 that archived it (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. Creates tarball, uploads to s3://agiliton-archive/projects/, updates database, and optionally deletes local copy.',
inputSchema: {
type: 'object',
properties: {
project_key: { type: 'string', description: 'Project key (must exist in database)' },
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'],
},
},
];