Skip to main content
Glama

get_root_id

Retrieve the root node ID from HNPX XML documents to enable structured fiction writing and hierarchical narrative development.

Instructions

Get ID of the book node (document root)

Args: file_path (str): Path to the HNPX document

Returns: str: ID of the book node

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the get_root_id tool. It parses the HNPX XML document from the given file_path and returns the 'id' attribute of the root 'book' element.
    def get_root_id(file_path: str) -> str:
        """Get ID of the book node (document root)
    
        Args:
            file_path (str): Path to the HNPX document
    
        Returns:
            str: ID of the book node
        """
        tree = hnpx.parse_document(file_path)
        root = tree.getroot()
        return root.get("id")
  • Registers the get_root_id function as an MCP tool using FastMCP's app.tool() decorator.
    app.tool()(tools.get_root_id)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool 'Get[s] ID' which implies a read operation, but doesn't disclose any behavioral traits like whether it requires specific file permissions, what happens with invalid paths, if it caches results, or error handling. For a tool with no annotation coverage, this is insufficient disclosure.

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 perfectly concise and well-structured: a clear purpose statement followed by Args and Returns sections. Every sentence earns its place with no wasted words. The information is front-loaded with the core purpose first.

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

Completeness4/5

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

Given the tool's simple nature (single parameter, read-only operation), the description combined with the output schema provides adequate context. The output schema handles return value documentation, so the description doesn't need to explain returns. However, for a tool with no annotations, more behavioral context would be beneficial.

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

Parameters4/5

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

With 0% schema description coverage, the description must compensate, and it does by explaining the single parameter: 'file_path (str): Path to the HNPX document'. This adds crucial meaning beyond the bare schema. However, it doesn't specify path format requirements or examples, so it's not a perfect 5.

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 tool's purpose: 'Get ID of the book node (document root)' with a specific verb ('Get') and resource ('book node ID'). It distinguishes from siblings like get_node or get_path by specifying it retrieves the root ID specifically. However, it doesn't explicitly contrast with all siblings, so it's not a perfect 5.

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. Given siblings like get_node, get_path, and get_subtree that also retrieve node information, there's no indication of when this specific root ID retrieval is preferred. The description only states what it does, not when to use it.

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/mozhaa/hnpx-sdk'

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