Skip to main content
Glama

get_file_context

Retrieve comprehensive file context including sessions, decisions, mistakes, and commits to support manuscript analysis and writing assistance.

Instructions

Get all context for a file (sessions, decisions, mistakes, commits)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathNoPath to manuscript directory (defaults to current directory)
file_pathYesFile to get context for

Implementation Reference

  • The main handler function for the 'get_file_context' MCP tool. Extracts the file_path argument and delegates execution to WritersAid.getFileContext.
    private async getFileContext(args: Record<string, unknown>) {
      const filePath = args.file_path as string;
    
      return this.writersAid.getFileContext({ filePath });
    }
  • Input schema and metadata definition for the 'get_file_context' tool, defining parameters like file_path.
      name: "get_file_context",
      description: "Get all context for a file (sessions, decisions, mistakes, commits)",
      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 context for" },
        },
        required: ["file_path"],
      },
    },
  • Core implementation of getFileContext: performs a holistic search across sessions, decisions, mistakes, and commits layers for the given filePath, then categorizes the results.
    async getFileContext(filePath: string): Promise<{
      recentSessions: SearchResult[];
      recentDecisions: SearchResult[];
      recentMistakes: SearchResult[];
      commits: SearchResult[];
    }> {
      const results = await this.search({
        query: filePath,
        layers: ["sessions", "decisions", "mistakes", "commits"],
        limit: 5,
      });
    
      const byLayer = {
        recentSessions: results.results.filter((r) => r.layer === "sessions"),
        recentDecisions: results.results.filter((r) => r.layer === "decisions"),
        recentMistakes: results.results.filter((r) => r.layer === "mistakes"),
        commits: results.results.filter((r) => r.layer === "commits"),
      };
    
      return byLayer;
    }
  • Delegation method in WritersAid class that forwards getFileContext call to the HolisticSearcher instance.
    async getFileContext(options: { filePath: string }) {
      return this.holisticSearcher.getFileContext(options.filePath);
    }
  • Dispatch case in handleTool switch statement that routes 'get_file_context' calls to the handler method.
    case "get_file_context":
      return this.getFileContext(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool retrieves context but doesn't disclose behavioral traits such as whether it's read-only (implied by 'Get'), what format the context is returned in, if there are rate limits, authentication needs, or error conditions. For a tool with no annotation coverage, this is a significant gap.

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

Conciseness5/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 ('Get all context for a file') and lists the context types without unnecessary words. Every part earns its place, making it highly concise and well-structured.

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 no annotations, no output schema, and a tool that retrieves multiple types of context, the description is incomplete. It doesn't explain what 'all context' entails in detail, how results are structured, or potential limitations. For a context-fetching tool with rich sibling tools, more completeness is needed to guide effective use.

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?

Schema description coverage is 100%, so the schema already documents both parameters (project_path and file_path) with descriptions. The description adds no additional meaning beyond implying 'file_path' is used to identify the target file, but it doesn't explain parameter interactions or provide examples. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb 'Get' and the resource 'all context for a file', specifying the types of context (sessions, decisions, mistakes, commits). It distinguishes from siblings like 'get_session_context' (which focuses on sessions only) and 'track_file_evolution' (which tracks changes over time). However, it doesn't explicitly contrast with all siblings, so it's not a perfect 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a file path), exclusions, or comparisons to siblings like 'get_session_context' (for session-specific data) or 'track_file_evolution' (for historical tracking). Usage is implied but not articulated.

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