Skip to main content
Glama

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
NameRequiredDescriptionDefault
file_pathYes
pathYes

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)
  • 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"} } } ),
  • 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"} } }

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