Skip to main content
Glama

read

Retrieve file contents from virtual filesystem workspaces using a specified path to access stored data.

Instructions

Read file contents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Core implementation of the 'read' tool handler in VFSTools class. Resolves path, reads file from VFS, decodes content, and returns ReadResponse.
    async def read(self, path: str) -> ReadResponse:
        """
        Read file contents.
    
        Args:
            path: File path (absolute or relative to cwd)
    
        Returns:
            ReadResponse with file contents
        """
        vfs = self.workspace_manager.get_current_vfs()
        resolved_path = self.workspace_manager.resolve_path(path)
    
        content = await vfs.read_file(resolved_path)
        if content is None:
            raise ValueError(f"Could not read file: {resolved_path}")
    
        content_str = content.decode("utf-8") if isinstance(content, bytes) else content
    
        return ReadResponse(
            path=resolved_path, content=content_str, size=len(content_str.encode())
        )
  • MCP server tool registration for 'read', delegating to VFSTools.read method.
    @server.tool
    async def read(path: str):
        """Read file contents."""
        return await vfs_tools.read(path)
  • Pydantic model defining the output schema for the 'read' tool response.
    class ReadResponse(BaseModel):
        """Response from read operation"""
    
        path: str
        content: str
        size: int
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. 'Read file contents' implies a read-only operation, but it doesn't specify what happens with binary files, large files, encoding issues, or error conditions. For a file I/O tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 maximally concise at just three words: 'Read file contents.' It's front-loaded with the essential information and contains zero wasted words or unnecessary elaboration.

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?

For a file reading tool with no annotations, no output schema, and 0% schema description coverage, the description is inadequate. It doesn't explain what format the content is returned in (text, binary, encoding), how errors are handled, or any limitations. Given the complexity of file I/O operations, this minimal description leaves too many questions unanswered.

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?

The schema has 0% description coverage, so the single 'path' parameter is undocumented in the schema. The description 'Read file contents' provides no information about the path parameter - whether it's absolute or relative, what formats are accepted, or any constraints. The description fails 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.

Purpose4/5

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

The description 'Read file contents' clearly states the verb ('Read') and resource ('file contents'), making the tool's purpose immediately understandable. However, it doesn't differentiate from potential siblings like 'grep' or 'find' that also involve reading files, so it doesn't reach the highest score.

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. With siblings like 'grep' (search file contents), 'find' (locate files), and 'ls' (list files), there's no indication of when 'read' is the appropriate choice versus these other file-related tools.

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/IBM/chuk-mcp-vfs'

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