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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
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
- src/mcp_server_code_assist/server.py:110-114 (registration)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)]
- src/mcp_server_code_assist/server.py:24-24 (registration)Enum definition for the read_file tool name.READ_FILE = "read_file"