Skip to main content
Glama

read_element

Retrieve specific content blocks from Markdown files using hierarchical paths to access structured document elements without manual text searching.

Instructions

Fetches the full content of a specific block by its path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
pathYes

Implementation Reference

  • Top-level asynchronous handler function for the 'read_element' tool. Delegates to the EditTool instance's read method.
    async def read_element(file_path: str, path: str): return await _instance.read(file_path, path)
  • Core logic of the read_element tool in EditTool class: loads the cached 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)
  • Input and output schema definition for the read_element tool, registered via list_tools().
    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"}, }, }, ),
  • Dispatch/registration in the server's call_tool method: calls the read_element handler when the tool name matches.
    elif name == "read_element": res = await read_element(file_path, arguments["path"]) return CallToolResult( content=[TextContent(type="text", text=json.dumps(res, ensure_ascii=False, indent=2))], structuredContent=res, isError="error" in res, )
  • Import statement bringing the read_element handler into server.py for use in tool dispatch.
    from .tools.edit_tools import ( get_document_structure, read_element, replace_content, insert_element, delete_element, undo_changes, search_in_document, get_element_context, move_document_element, update_document_metadata, )

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/KazKozDev/markdown-editor-mcp-server'

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