Skip to main content
Glama

edit_paragraph_text

Modify paragraph text content in HNPX documents by specifying file path, paragraph ID, and new text for narrative editing.

Instructions

Edit paragraph text content

Args: file_path (str): Path to the HNPX document node_id (str): ID of the paragraph node to modify new_text (str): New paragraph text content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
paragraph_idYes
new_textYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that implements the logic to edit the text content of a specific paragraph node in an HNPX document. It parses the document, finds the node, validates it is a paragraph, updates the text, saves the document, and returns a success message.
    def edit_paragraph_text(file_path: str, paragraph_id: str, new_text: str) -> str:
        """Edit paragraph text content
    
        Args:
            file_path (str): Path to the HNPX document
            node_id (str): ID of the paragraph node to modify
            new_text (str): New paragraph text content
        """
        tree = hnpx.parse_document(file_path)
        paragraph = hnpx.find_node(tree, paragraph_id)
    
        if paragraph is None:
            raise NodeNotFoundError(paragraph_id)
    
        # Verify it's a paragraph element
        if paragraph.tag != "paragraph":
            raise InvalidOperationError(
                "edit_paragraph_text", f"Node {paragraph_id} is not a paragraph"
            )
    
        # Update the paragraph text content
        paragraph.text = new_text
    
        hnpx.save_document(tree, file_path)
    
        return f"Updated text content for paragraph {paragraph_id}"
  • Registers the edit_paragraph_text tool with the FastMCP server using the app.tool() decorator.
    app.tool()(tools.edit_paragraph_text)
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 for behavioral disclosure. While 'Edit' implies mutation, the description doesn't specify whether this operation is reversible, what permissions are required, whether it overwrites or merges content, or what happens to formatting. For a mutation tool with zero annotation coverage, this is a significant gap.

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 documentation. The structure is logical and front-loaded, though the parameter documentation could be more integrated rather than appearing 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 mutation tool with no annotations, 3 parameters at 0% schema coverage, but with an output schema present, the description is minimally adequate. The output schema existence means return values don't need explanation, but the description should do more to explain parameter semantics and behavioral implications of editing paragraph text.

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

Parameters2/5

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

With 0% schema description coverage and 3 parameters, the description must compensate but provides only basic parameter names without explaining their semantics. It doesn't clarify what format 'file_path' expects, what constitutes a valid 'node_id', or whether 'new_text' supports formatting. The description adds minimal value beyond what the bare schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Edit paragraph text content', which is a clear verb+resource combination. However, it doesn't distinguish this from sibling tools like 'edit_node_attributes' or 'edit_summary', leaving ambiguity about when to use this specific paragraph editing tool versus other editing tools in the server.

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. With sibling tools like 'edit_node_attributes' and 'edit_summary' available, there's no indication whether this is for basic text replacement versus more complex editing scenarios, or any prerequisites for using this tool.

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