Skip to main content
Glama

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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions retrieving 'detailed context' but doesn't specify what that includes (e.g., metadata, content snippets, timestamps), whether it's read-only or has side effects, or any limitations like rate limits or authentication needs. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. It avoids redundancy and waste, making it easy to parse, though it could be slightly more informative without losing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of retrieving session context, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'detailed context' includes, how results are structured, or any behavioral traits, leaving the agent with insufficient information to use the tool effectively beyond basic parameter input.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so parameters are well-documented in the schema. The description adds no additional meaning beyond implying that parameters relate to fetching session context, but it doesn't clarify interactions between parameters (e.g., if 'file_path' is required when 'project_path' is set). Baseline 3 is appropriate as the schema handles most of the parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Get detailed context for a specific file or concept from past sessions', which provides a clear verb ('Get') and resource ('context'), but it's vague about what 'context' entails and doesn't differentiate from siblings like 'get_file_context' or 'recall_writing_session'. It specifies the scope ('from past sessions') but lacks precision on the nature of the context returned.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'get_file_context' or 'recall_writing_session'. The description implies usage for retrieving session-based context but offers no explicit when/when-not instructions or prerequisites, leaving the agent to infer usage from the name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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