Skip to main content
Glama

agentbay_project_read_file

Read a specific file from a project using its project ID and file path to retrieve the file contents.

Instructions

Read a single file from a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
pathYesFile path within the project (e.g. "src/index.ts")

Implementation Reference

  • The tool handler function that executes the 'agentbay_project_read_file' logic. It takes projectId and path parameters, calls the API endpoint to read a file from the project, and returns the file content with metadata (version, size).
      async ({ projectId, path }) => {
        const data = await apiGet(`/api/v1/projects/${projectId}/files/${path}`);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        return { content: [{ type: 'text' as const, text: `# ${data.path} (v${data.version}, ${(data.sizeBytes / 1024).toFixed(1)}KB)\n\n\`\`\`\n${data.content}\n\`\`\`` }] };
      }
    );
  • Input schema for the tool. Defines 'projectId' (string, required) and 'path' (string, required) as Zod-validated parameters.
    {
      projectId: z.string().describe('Project ID'),
      path: z.string().describe('File path within the project (e.g. "src/index.ts")'),
    },
  • src/index.ts:1039-1052 (registration)
    Registration of the tool via server.tool() call with the name 'agentbay_project_read_file' and description 'Read a single file from a project'.
    // Tool 38: Project Read File
    server.tool(
      'agentbay_project_read_file',
      'Read a single file from a project',
      {
        projectId: z.string().describe('Project ID'),
        path: z.string().describe('File path within the project (e.g. "src/index.ts")'),
      },
      async ({ projectId, path }) => {
        const data = await apiGet(`/api/v1/projects/${projectId}/files/${path}`);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
        return { content: [{ type: 'text' as const, text: `# ${data.path} (v${data.version}, ${(data.sizeBytes / 1024).toFixed(1)}KB)\n\n\`\`\`\n${data.content}\n\`\`\`` }] };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full responsibility for behavioral disclosure. It does not mention side effects, permissions, file existence requirements, error handling, or any constraints like file size limits. The term 'Read' implies non-destructiveness, but that is minimal.

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 very concise at one sentence and front-loaded with the action and resource. However, it may be overly terse; a bit more detail could improve usability 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 lack of an output schema, the description does not explain what the tool returns (e.g., file content, success status) or any other contextual details like encoding, max size, or error behavior. This leaves significant gaps for an agent to understand the full behavior.

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?

Since schema description coverage is 100%, the baseline is 3. The description does not add any additional meaning beyond what the input schema already provides (projectId and path descriptions are generic). No parameter semantics are enhanced.

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 action ('Read') and the resource ('a single file from a project'), distinguishing it from sibling tools like agentbay_project_files (list) and agentbay_project_push_files (write). However, it lacks specificity about what 'read' returns (e.g., content, metadata) and could be more explicit.

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. For example, it does not specify that this tool is for reading file content while agentbay_project_files is for listing. No exclusions or context are given.

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/thomasjumper/agentbay-mcp'

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