get_session_context
Retrieve detailed context from past writing sessions for specific files or concepts to maintain consistency and reference previous work.
Instructions
Get detailed context for a specific file or concept from past sessions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | No | Path to manuscript directory (defaults to current directory) | |
| file_path | No | File to get session context for | |
| limit | No | Maximum sessions to return |
Implementation Reference
- src/tools/WriterToolHandlers.ts:346-351 (handler)The primary handler function for the 'get_session_context' tool. It extracts file_path and limit from arguments and delegates to WritersAid.getSessionContext for execution.private async getSessionContext(args: Record<string, unknown>) { const filePath = args.file_path as string | undefined; const limit = (args.limit as number) || 5; return this.writersAid.getSessionContext({ filePath, limit }); }
- src/WritersAid.ts:357-390 (handler)Core implementation logic for retrieving session context. Fetches sessions and decisions related to a specific file using SessionManager and DecisionExtractor.async getSessionContext(options: { filePath?: string; limit?: number }) { if (!options.filePath) { return { sessions: [], decisions: [], message: "No file path provided", }; } const sessions = this.sessionManager.getSessionsForFile( options.filePath, options.limit || 5 ); const decisions = this.decisionExtractor.getDecisionsByFile( options.filePath, options.limit || 5 ); return { file: options.filePath, sessions: sessions.map((session) => ({ id: session.id, startedAt: new Date(session.startedAt).toISOString(), summary: session.summary || "Writing session", })), decisions: decisions.map((decision) => ({ decisionText: decision.decisionText, rationale: decision.rationale, decisionType: decision.decisionType, timestamp: new Date(decision.timestamp).toISOString(), })), }; }
- Input schema definition for the 'get_session_context' tool, specifying parameters like project_path, file_path, and limit.{ name: "get_session_context", description: "Get detailed context for a specific file or concept from past sessions", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" }, file_path: { type: "string", description: "File to get session context for" }, limit: { type: "number", description: "Maximum sessions to return", default: 5 }, }, }, },
- src/tools/WriterToolHandlers.ts:66-67 (registration)Tool dispatch registration in the central handleTool switch statement, routing 'get_session_context' calls to the handler method.case "get_session_context": return this.getSessionContext(args);