read_element
Retrieve specific content blocks from Markdown files using hierarchical paths to access document elements without manual text searching.
Instructions
Fetches the full content of a specific block by its path.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| path | Yes |
Implementation Reference
- The primary handler function for the 'read_element' tool. It delegates to the EditTool instance's read method to fetch the document element.async def read_element(file_path: str, path: str): return await _instance.read(file_path, path)
- Core helper method in EditTool class that loads the document and retrieves the specific element using its view_element method.async def read(self, file_path: str, path: str) -> Dict[str, Any]: doc = self.get_doc(file_path) return doc.view_element(path)
- src/markdown_editor/server.py:175-201 (registration)Tool registration in list_tools(), defining name, description, inputSchema, and outputSchema for 'read_element'.Tool( name="read_element", title="Read Specific Element", description="Fetches the full content of a specific block by its path.", inputSchema={ "type": "object", "properties": { "file_path": { "type": "string", "examples": ["./document.md"] }, "path": { "type": "string", "examples": ["Features > list 1", "Introduction"] } }, "required": ["file_path", "path"], "additionalProperties": False }, outputSchema={ "type": "object", "properties": { "element": {"type": "object", "description": "The requested element"}, "content": {"type": "string", "description": "Element content"} } } ),
- src/markdown_editor/server.py:558-560 (registration)Dispatch logic in call_tool() that invokes the read_element handler when the tool is called.elif name == "read_element": res = await read_element(file_path, arguments["path"]) return {"content": [TextContent(type="text", text="Element read")], "structuredContent": res, "isError": "error" in res}
- Input and output schema definitions for the read_element tool.inputSchema={ "type": "object", "properties": { "file_path": { "type": "string", "examples": ["./document.md"] }, "path": { "type": "string", "examples": ["Features > list 1", "Introduction"] } }, "required": ["file_path", "path"], "additionalProperties": False }, outputSchema={ "type": "object", "properties": { "element": {"type": "object", "description": "The requested element"}, "content": {"type": "string", "description": "Element content"} } }