Skip to main content
Glama

remove_node_children

Remove all child elements from a specified parent node in HNPX XML documents to restructure narrative hierarchies during fiction writing.

Instructions

Remove all children of a node

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
node_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that parses the HNPX document, finds the node by ID, removes all its non-summary children, saves the document, and returns a confirmation message.
    def remove_node_children(file_path: str, node_id: str) -> str:
        """Remove all children of a node
    
        Args:
            file_path (str): Path to the HNPX document
            node_id (str): ID of the parent node
        """
        tree = hnpx.parse_document(file_path)
        node = hnpx.find_node(tree, node_id)
    
        if node is None:
            raise NodeNotFoundError(node_id)
    
        children_count = 0
    
        # Remove all children except summary
        for child in list(node):
            if child.tag != "summary":
                node.remove(child)
                children_count += 1
    
        hnpx.save_document(tree, file_path)
    
        return f"Removed {children_count} children from node {node_id}"
  • Registers the remove_node_children tool with the MCP server using the app.tool() decorator.
    app.tool()(tools.remove_node_children)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Remove all children') which implies a destructive mutation, but doesn't specify whether this is reversible, what permissions are required, what happens to the children (deleted vs orphaned), or any rate limits. The description is minimal and lacks important behavioral context for a destructive operation.

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

Conciseness4/5

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

The description is appropriately concise with a clear purpose statement followed by parameter explanations. The two-sentence structure is efficient with no wasted words. However, the parameter explanations could be integrated more naturally rather than as a separate 'Args:' section.

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 this is a destructive mutation tool with no annotations, 0% schema description coverage, but with an output schema (which handles return values), the description is minimally adequate. It covers the basic action and parameters but lacks important context about the mutation's behavior, safety considerations, and relationship to sibling tools. The presence of an output schema prevents this from being a complete failure.

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

Parameters3/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 documentation. The description adds basic semantics for both parameters ('Path to the HNPX document' and 'ID of the parent node'), establishing their roles. However, it doesn't explain format expectations (e.g., what constitutes a valid node_id, file path conventions) or provide examples, leaving significant gaps.

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 verb ('Remove') and resource ('all children of a node'), making the purpose specific and understandable. It distinguishes from sibling 'remove_nodes' which likely removes nodes themselves rather than just their children. However, it doesn't explicitly mention the HNPX document format context beyond the parameter description.

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 like 'remove_nodes' or 'reorder_children'. There's no mention of prerequisites, consequences, or typical scenarios for removing children versus other operations. The agent must infer usage from the name 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