UNPKG

@jmkim85/dev-flow-mcp

Version:

MCP-based Dev Flow - AI-powered development workflow management with 13 essential tools for TDD and context management

88 lines (84 loc) 2.57 kB
/** * Context Tool Handlers Module * Implements context management MCP tool handlers for Dev Flow */ import { stateManager, unifiedContextManager } from './globals.js'; // Context management tool handler implementations export async function createContextFrame(taskId, stage, summary) { try { const frame = await unifiedContextManager.createFrame(taskId, stage); if (summary) { await unifiedContextManager.updateFrame({ summary }); } return { content: [{ type: "text", text: `✅ **Context Frame Created** **Frame ID**: ${frame.id} **Task**: ${taskId} **Stage**: ${stage} ${summary ? `**Summary**: ${summary}` : ''} This frame will track context for the current work session.` }] }; } catch (error) { return { content: [{ type: "text", text: `❌ Error creating context frame: ${error.message}` }] }; } } export async function addContextFact(fact, isGlobal = false) { try { await unifiedContextManager.addFact(fact, isGlobal); return { content: [{ type: "text", text: `✅ **Fact Added to Context** **Fact**: ${fact} **Scope**: ${isGlobal ? 'Global (applies to all tasks)' : 'Current frame only'} This information will be preserved in the context.` }] }; } catch (error) { return { content: [{ type: "text", text: `❌ Error adding context fact: ${error.message}` }] }; } } export async function getContext() { try { const state = await stateManager.getCurrentState(); if (!state.current_task) { return { content: [{ type: "text", text: "⚠️ No active task. Use `get_next_task` to see what to work on." }] }; } const contextSummary = await unifiedContextManager.buildContext(state.current_task); return { content: [{ type: "text", text: contextSummary }] }; } catch (error) { return { content: [{ type: "text", text: `❌ Error getting context: ${error.message}` }] }; } } //# sourceMappingURL=context-tool-handlers.js.map