Skip to main content
Glama

apply_numbered_list

Add numbered list formatting to specific paragraphs in Word documents. Select paragraphs by index and choose from multiple numbering formats like 1, a, i, I, or A.

Instructions

Apply numbered list formatting to paragraphs.

Args: filepath: Path to the document paragraph_indices: List of paragraph indices to number number_format: Format for numbering ('1', 'a', 'i', 'I', 'A')

Returns: Dictionary with status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes
paragraph_indicesYes
number_formatNo1

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the apply_numbered_list tool, which applies numbered list formatting to specified paragraphs in a docx document.
    @app.tool()
    def apply_numbered_list(
        filepath: str,
        paragraph_indices: list[int],
        number_format: str = "1",
    ) -> dict[str, Any]:
        """
        Apply numbered list formatting to paragraphs.
    
        Args:
            filepath: Path to the document
            paragraph_indices: List of paragraph indices to number
            number_format: Format for numbering ('1', 'a', 'i', 'I', 'A')
    
        Returns:
            Dictionary with status
        """
        logger.info(
            "Applying numbered list",
            extra={"tool": "apply_numbered_list", "filepath": filepath},
        )
    
        try:
            doc = safe_open_document(filepath)
    
            # Validate indices
            for idx in paragraph_indices:
                if idx < 0 or idx >= len(doc.paragraphs):
                    raise InvalidParameterError("paragraph_indices", f"Index {idx} out of range")
    
            # Apply numbered formatting
            for idx in paragraph_indices:
                paragraph = doc.paragraphs[idx]
                paragraph.paragraph_format.left_indent = Inches(0.5)
                paragraph.style = "List Number"
    
            safe_save_document(doc, filepath)
            logger.info(
                f"Applied numbered list to {len(paragraph_indices)} paragraphs",
                extra={"filepath": filepath},
            )
    
            return {
                "status": "success",
                "filepath": filepath,
                "paragraphs_updated": len(paragraph_indices),
                "number_format": number_format,
            }
        except DocxMcpError as e:
            logger.warning(e.message, extra={"tool": "apply_numbered_list", "error_code": e.error_code})
            return {"status": "error", "error": e.message, "error_code": e.error_code}
        except Exception as e:
            logger.error(f"Unexpected error applying numbered list: {str(e)}")
            return {"status": "error", "error": str(e)}
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool applies formatting and returns a dictionary with status, but it doesn't cover critical aspects like whether this is a mutation (likely yes, given 'apply'), error handling, side effects, or performance considerations. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 sized and front-loaded, with the core purpose stated first. The 'Args' and 'Returns' sections are structured clearly, though the 'Args' explanations are minimal. There's no wasted text, but the lack of usage context slightly reduces efficiency.

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 the tool has 3 parameters with 0% schema coverage and no annotations, but does have an output schema (implied by 'Returns: Dictionary with status'), the description is moderately complete. It covers the basic purpose and parameters, but misses behavioral details and usage guidelines. The output schema reduces the need to explain return values, but overall context is still lacking for a mutation tool.

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 descriptions. The description includes an 'Args' section that lists parameters with brief explanations, adding meaning beyond the bare schema. However, it doesn't fully compensate for the coverage gap—e.g., it doesn't explain valid ranges for 'paragraph_indices' or details on 'number_format' beyond listing options. This provides basic but incomplete semantic context.

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: 'Apply numbered list formatting to paragraphs.' This specifies the verb ('apply'), resource ('numbered list formatting'), and target ('paragraphs'). However, it doesn't explicitly differentiate from its sibling 'apply_bullet_list' beyond the obvious difference in list type, which is why it doesn't reach 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 sibling tools like 'apply_bullet_list' or 'apply_paragraph_style', nor does it specify prerequisites, constraints, or typical use cases. The only implied usage is formatting paragraphs as numbered lists, but this is basic and lacks context.

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/Andrew82106/LLM_Docx_Agent_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server