Skip to main content
Glama

get_children

Retrieve direct child nodes from a specified parent in HNPX XML documents to support hierarchical fiction writing and narrative expansion.

Instructions

Retrieve immediate child nodes of a specified parent

Args: file_path (str): Path to the HNPX document node_id (str): ID of the parent node

Returns: str: Concatenated XML representation of all direct child nodes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
node_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_children' tool. It parses the HNPX document, finds the parent node by ID, collects XML of direct children (excluding summary), removes their children, and returns concatenated XML strings.
    def get_children(file_path: str, node_id: str) -> str:
        """Retrieve immediate child nodes of a specified parent
    
        Args:
            file_path (str): Path to the HNPX document
            node_id (str): ID of the parent node
    
        Returns:
            str: Concatenated XML representation of all direct child nodes
        """
        tree = hnpx.parse_document(file_path)
        parent = hnpx.find_node(tree, node_id)
    
        if parent is None:
            raise NodeNotFoundError(node_id)
    
        # Return concatenated XML of all direct children
        children_xml = []
        for child in parent:
            if child.tag == "summary":
                continue
            _remove_children(child)
            children_xml.append(etree.tostring(child, encoding="unicode", method="html"))
    
        return "\n".join(children_xml)
  • Registers the get_children function as a tool in the FastMCP application.
    app.tool()(tools.get_children)
Behavior3/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 the tool retrieves data (implying read-only, non-destructive) and specifies the return format ('Concatenated XML representation'), which is useful context. However, it doesn't cover error handling, permissions, or rate limits, leaving gaps for a tool with no annotation support.

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 front-loaded with the core purpose in the first sentence, followed by structured sections for Args and Returns. Each sentence earns its place by providing essential information without redundancy, making it highly efficient and well-organized.

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 moderate complexity (2 parameters, no annotations, but with an output schema), the description is mostly complete. It explains the purpose, parameters, and return format. Since an output schema exists, it doesn't need to detail return values further. However, it lacks usage guidelines and some behavioral context, preventing a perfect score.

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?

Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that 'file_path' refers to 'Path to the HNPX document' and 'node_id' is the 'ID of the parent node', clarifying the parameters' roles beyond their names. However, it doesn't detail format constraints (e.g., HNPX structure, ID syntax), so it's not a full 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: 'Retrieve immediate child nodes of a specified parent'. It specifies the verb ('Retrieve') and resource ('immediate child nodes'), and distinguishes it from siblings like 'get_subtree' (which retrieves deeper descendants) and 'get_node' (which retrieves a single node). 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. It doesn't mention when to choose 'get_children' over 'get_subtree' (for deeper descendants) or 'get_node' (for the parent itself), nor does it specify prerequisites or exclusions. The agent must infer usage from the purpose alone.

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