Skip to main content
Glama

read

Retrieve file contents from virtual filesystem workspaces. Specify a file path to access stored data across multiple storage providers.

Instructions

Read file contents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Core handler function that executes the read tool logic: 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()) )
  • Pydantic model defining the output schema for the read tool.
    class ReadResponse(BaseModel): """Response from read operation""" path: str content: str size: int
  • MCP server registration of the 'read' tool using @server.tool decorator, delegating to VFSTools.read method.
    @server.tool async def read(path: str): """Read file contents.""" return await vfs_tools.read(path)

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

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