Skip to main content
Glama
KazKozDev
by KazKozDev

Read Specific Element

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoElement content
elementNoThe requested element

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,
    )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'fetches' content, implying a read operation, but doesn't cover critical aspects like error handling (e.g., if the path is invalid), performance (e.g., rate limits), or output format (though an output schema exists). This leaves gaps in understanding how the tool behaves beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('fetches') and resource. There is no wasted wording, and it directly communicates the tool's function without unnecessary elaboration, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 required parameters) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and 0% schema coverage, it lacks details on error cases, permissions, or behavioral nuances. It meets a basic threshold but doesn't provide a complete picture for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description mentions 'by its path' but doesn't explain what 'file_path' and 'path' represent or how they differ (e.g., file location vs. block hierarchy). It adds minimal semantic value beyond the parameter names, failing to compensate for the lack of schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('fetches') and resource ('full content of a specific block'), making the purpose understandable. It distinguishes from siblings like 'get_document_structure' (which likely lists elements) or 'search_text' (which searches content). However, it doesn't explicitly differentiate from 'get_context' or other read-like siblings, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing the file to exist), exclusions (e.g., not for metadata), or comparisons to siblings like 'get_document_structure' for overviews or 'search_text' for content queries. Usage is implied by the name but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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