Skip to main content
Glama
xiaolai
by xiaolai

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
NameRequiredDescriptionDefault
project_pathNoPath to manuscript directory (defaults to current directory)
file_pathNoFile to get session context for
limitNoMaximum sessions to return

Implementation Reference

  • 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 });
    }
  • 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 },
        },
      },
    },
  • 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);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xiaolai/claude-writers-aid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server