Skip to main content
Glama

list_content_controls

Extract all content controls from a Microsoft Word document to identify editable regions, placeholders, and structured elements for document automation or analysis.

Instructions

List all content controls in a document.

Args: filepath: Path to the document

Returns: Dictionary with list of content controls

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the 'list_content_controls' tool, which extracts content controls (tags and titles) from a Word document.
    def list_content_controls(filepath: str) -> dict[str, Any]:
        """
        List all content controls in a document.
    
        Args:
            filepath: Path to the document
    
        Returns:
            Dictionary with list of content controls
        """
        logger.info(
            "Listing content controls",
            extra={"tool": "list_content_controls", "filepath": filepath},
        )
    
        try:
            doc = safe_open_document(filepath)
            controls = []
    
            # Find content controls in document
            for element in doc.element.body:
                # Look for content control elements
                sdt_elements = element.xpath(".//w:sdt")
                for sdt in sdt_elements:
                    # Extract control properties
                    properties = sdt.xpath(".//w:sdtPr")
                    if properties:
                        prop = properties[0]
                        tag_elements = prop.xpath(".//w:tag")
                        title_elements = prop.xpath(".//w:alias")
    
                        ns_val = (
                            "{http://schemas.openxmlformats.org/wordprocessingml/"
                            "2006/main}val"
                        )
                        tag = tag_elements[0].get(ns_val, "")
                        title = title_elements[0].get(ns_val, "")
    
                        controls.append({
                            "tag": tag,
                            "title": title,
                        })
    
            return {
                "status": "success",
                "filepath": filepath,
                "content_controls": controls,
                "count": len(controls),
            }
  • The tool is registered using the @app.tool() decorator.
    @app.tool()
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. It mentions the action 'List all content controls' but fails to describe key traits like read-only vs. destructive nature, error handling, permissions needed, or output format details beyond a vague 'Dictionary with list'. This leaves significant gaps for an agent to understand the tool's 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 front-loaded with the core purpose in the first sentence, followed by structured Args and Returns sections. It avoids unnecessary fluff, but the 'Returns' line is somewhat vague ('Dictionary with list'), which slightly detracts from 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's low complexity (1 parameter) and the presence of an output schema, the description is minimally adequate. However, without annotations and with 0% schema coverage, it should provide more behavioral context and parameter details to fully guide an agent, especially in a server with many sibling tools.

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?

The schema description coverage is 0%, so the description must compensate. It adds minimal semantics by naming the parameter 'filepath' and implying it's a path to a document, but does not elaborate on format, constraints, or examples. With only one parameter, the baseline is 4, but the lack of detail beyond the schema's basic type reduces the score.

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 'List' and the resource 'content controls in a document', making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'list_docx' or 'list_styles', which reduces clarity in a crowded toolset.

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, such as other list tools (e.g., 'list_docx' for documents or 'list_styles' for styles). It lacks context on prerequisites, exclusions, or typical use cases, offering only basic operational info.

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