Skip to main content
Glama

create_document

Create a new empty HNPX document for structured fiction writing, enabling hierarchical narrative development from book planning to paragraph details.

Instructions

Create a new empty HNPX document

Args: file_path (str): Path where the new HNPX document will be created

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that implements the create_document tool logic, generating a new HNPX document with a random book ID and saving it to the specified file path.
    def create_document(file_path: str) -> str:
        """Create a new empty HNPX document
    
        Args:
            file_path (str): Path where the new HNPX document will be created
        """
        # Generate initial book ID
        book_id = "".join(random.choices(string.ascii_lowercase + string.digits, k=6))
    
        # Create minimal document
        book = etree.Element("book", id=book_id)
        summary = etree.SubElement(book, "summary")
        summary.text = "New book"
    
        # Create tree and save
        tree = etree.ElementTree(book)
        hnpx.save_document(tree, file_path)
    
        return f"Created book with id {book_id} at {file_path}"
  • Registration of the create_document tool using the FastMCP app.tool() decorator.
    app.tool()(tools.create_document)
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 states it 'creates' a new document, implying a write/mutation operation, but doesn't disclose behavioral traits such as permissions required, whether it overwrites existing files, error handling (e.g., invalid paths), or what 'empty' entails (e.g., default structure). This leaves significant gaps for a mutation tool.

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 appropriately sized and front-loaded: the first sentence states the core purpose, and the Args section efficiently documents the parameter. There is no wasted text, and every sentence adds value (defining the tool and its parameter).

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 complexity (a mutation tool with 1 parameter, 0% schema coverage, no annotations, but has output schema), the description is minimally adequate. It covers the basic action and parameter, but lacks behavioral details (e.g., side effects, error cases) and doesn't leverage the output schema to explain return values. For a creation tool, more context on outcomes would be helpful.

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' is where the new document 'will be created,' clarifying its purpose beyond the schema's type/requirement. However, it doesn't specify format (e.g., file extension like .hnpx) or constraints (e.g., absolute vs. relative paths), leaving some ambiguity.

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 ('Create a new empty HNPX document') and specifies the resource type (HNPX document). It distinguishes from siblings like create_beat, create_chapter, etc., by specifying it creates an 'empty document' rather than content elements. However, it doesn't explicitly differentiate from all siblings (e.g., edit_node_attributes could also create nodes).

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 a valid file path), exclusions (e.g., not for editing existing documents), or comparisons to siblings like create_paragraph (for content within documents) or get_empty (which might retrieve empty documents).

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