Skip to main content
Glama
doko89
by doko89

read_context

Retrieve project documentation content from local markdown files by specifying project name and file path to access organized context information.

Instructions

Read the content of a specific context file within a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_nameYesName of the project
file_pathYesRelative path to the file within the project (e.g., 'backend/gin.md')

Implementation Reference

  • MCP tool handler for 'read_context': validates project_name and file_path arguments, calls readContext helper, and returns the file content as text.
    case "read_context": {
      const projectName = args.project_name as string;
      const filePath = args.file_path as string;
    
      if (!projectName || !filePath) {
        throw new Error("project_name and file_path are required");
      }
    
      const content = await readContext(projectName, filePath);
      return {
        content: [
          {
            type: "text",
            text: content,
          },
        ],
      };
    }
  • Input schema definition for the 'read_context' tool, specifying required project_name and file_path parameters.
    inputSchema: {
      type: "object",
      properties: {
        project_name: {
          type: "string",
          description: "Name of the project",
        },
        file_path: {
          type: "string",
          description:
            "Relative path to the file within the project (e.g., 'backend/gin.md')",
        },
      },
      required: ["project_name", "file_path"],
    },
  • Helper function that reads the content of a specific context file, including path security validation to prevent directory traversal.
    async function readContext(
      projectName: string,
      filePath: string
    ): Promise<string> {
      const fullPath = path.join(CONTEXT_DIR, projectName, filePath);
      
      // Security check: ensure path is within context directory
      const resolvedPath = path.resolve(fullPath);
      const resolvedContextDir = path.resolve(CONTEXT_DIR);
      if (!resolvedPath.startsWith(resolvedContextDir)) {
        throw new Error("Invalid path: outside context directory");
      }
    
      return await fs.readFile(fullPath, "utf-8");
    }
  • src/index.ts:183-202 (registration)
    Tool registration in the list_tools response, including name, description, and schema.
    {
      name: "read_context",
      description:
        "Read the content of a specific context file within a project",
      inputSchema: {
        type: "object",
        properties: {
          project_name: {
            type: "string",
            description: "Name of the project",
          },
          file_path: {
            type: "string",
            description:
              "Relative path to the file within the project (e.g., 'backend/gin.md')",
          },
        },
        required: ["project_name", "file_path"],
      },
    },
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 states the action ('read') but doesn't mention potential errors (e.g., file not found, permission issues), return format (e.g., text content, metadata), or side effects (e.g., caching). This leaves significant gaps for a tool that interacts with files.

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 directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 file reading (potential errors, return formats) and the lack of annotations and output schema, the description is incomplete. It doesn't address what happens on success or failure, leaving the agent uncertain about behavioral outcomes.

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, clearly documenting both parameters ('project_name' and 'file_path') with examples. The description adds no additional parameter semantics beyond what the schema provides, so the baseline score of 3 is appropriate.

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 ('read') and resource ('content of a specific context file within a project'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'search_context' or 'get_project_structure', which likely have overlapping or related functionality.

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 like 'search_context' or 'get_project_structure'. It lacks context about prerequisites (e.g., whether the project must exist) or exclusions (e.g., not for binary files).

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/doko89/mcp-mycontext'

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