Skip to main content
Glama

doc_read

Reads and extracts content from documents to provide information for local LLMs. Use this tool to access file contents without requiring API keys.

Instructions

Alias of doc.read

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The core handler function that reads the content of a file (text or PDF) from the sandbox directory, resolves the path, checks access permissions, parses PDF if necessary, and returns the path and text content.
    export async function docRead(p: string) {
      const full = path.resolve(p);
      if (!full.startsWith(CONFIG.sandboxDir)) throw new Error('Access outside sandbox is not allowed');
      const buf = await fs.readFile(full);
      let text = '';
      if (/\.pdf$/i.test(full)) {
        try { const parsed = await pdfParseLazy(buf as unknown as Buffer); text = parsed.text || ''; } catch { text = ''; }
      } else { text = buf.toString('utf-8'); }
      return { path: full, text };
    }
  • Zod schema defining the input for the doc_read tool: a string path parameter.
    const docReadShape = { path: z.string() };
  • src/server.ts:133-139 (registration)
    Registration of the 'doc_read' tool on the MCP server, which is an alias calling the docRead handler with the provided path and formatting the response.
    server.tool('doc_read', 'Alias of doc.read',
      docReadShape, OPEN,
      async ({ path }) => {
        const res = await docRead(path);
        return { content: [{ type: 'text', text: JSON.stringify(res) }] };
      }
    );
Behavior3/5

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

The description adds no behavioral information beyond what the openWorldHint annotation provides. While the annotation suggests this tool may access external resources, the description doesn't elaborate on what 'doc.read' actually does, what kind of documents it reads, authentication requirements, rate limits, or error conditions. However, it doesn't contradict the annotation, so it avoids the lowest score.

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 extremely concise at just three words, with zero wasted text. While it's under-specified for a tool description, it's perfectly efficient in terms of word economy and structure. Every word serves a purpose in conveying the limited information it provides.

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

Completeness1/5

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

For a tool with no output schema, minimal annotations (only openWorldHint), and 0% schema description coverage, the description is completely inadequate. It doesn't explain what the tool does, what it returns, how to use it, or why it exists as an alias. This leaves the agent with insufficient information to properly understand or invoke the tool.

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

Parameters2/5

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

With 0% schema description coverage for the single 'path' parameter, the description provides no semantic information about what the path parameter represents, what format it should be in, or what constraints exist. The description 'Alias of doc.read' doesn't help understand the parameter at all, failing to compensate for the schema's lack of documentation.

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

Purpose1/5

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

The description 'Alias of doc.read' is a tautology that merely restates the tool name without explaining what the tool actually does. It doesn't specify the verb (read) or resource (document), nor does it distinguish this tool from its sibling 'doc.read' which appears to be the same functionality. This provides no meaningful purpose clarification.

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

Usage Guidelines1/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 explain why this alias exists alongside 'doc.read', when to choose one over the other, or what context would make this tool appropriate. There's complete absence of usage context or alternatives.

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/khanhs-234/tool4lm'

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