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

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)

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