Skip to main content
Glama

read_file

Read file content to access and analyze code or text within development workflows. Use this tool to retrieve file data for editing, reviewing, or processing in programming tasks.

Instructions

Reads file content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Core implementation of read_file tool logic: validates path and reads file content.
    async def read_file(self, path: str) -> str: path = await self.validate_path(path) try: return path.read_text() except Exception as e: self.handle_error(e, {"operation": "read", "path": str(path)})
  • Pydantic input schema for the read_file tool.
    class FileRead(BaseModel): path: str | Path
  • Registration of the read_file tool in MCP server's list_tools().
    Tool( name=CodeAssistTools.READ_FILE, description="Reads file content", inputSchema=FileRead.model_json_schema(), ),
  • MCP call_tool handler for read_file, parses input and delegates to file_tools.read_file.
    case CodeAssistTools.READ_FILE: model = FileRead(path=arguments["path"]) result = await file_tools.read_file(model.path) return [TextContent(type="text", text=result)]
  • Enum definition for the read_file tool name.
    READ_FILE = "read_file"

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/abhishekbhakat/mcp_server_code_assist'

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