Skip to main content
Glama

list_images

Extract and display all images from a Microsoft Word document with metadata for easy reference and management.

Instructions

List all images in a document.

Args: filepath: Path to the document

Returns: Dictionary with list of images and metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the `list_images` tool, which lists images in a docx document. It is registered via the `@app.tool()` decorator on line 980.
    def list_images(filepath: str) -> dict[str, Any]:
        """
        List all images in a document.
    
        Args:
            filepath: Path to the document
    
        Returns:
            Dictionary with list of images and metadata
        """
        logger.info("Listing images", extra={"tool": "list_images", "filepath": filepath})
    
        try:
            doc = safe_open_document(filepath)
            images = []
    
            # Count images in document relationships
            for rel in doc.part.rels.values():
                if "image" in rel.target_ref:
                    images.append({
                        "filename": rel.target_part.filename,
                        "content_type": rel.target_part.content_type,
                    })
    
            return {
                "status": "success",
                "filepath": filepath,
                "images": images,
                "count": len(images),
            }
        except DocxMcpError as e:
            logger.warning(e.message, extra={"tool": "list_images", "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 listing images: {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 states the tool lists images and metadata, but it does not describe how the listing is performed (e.g., format, pagination, error handling), what metadata is included, or any constraints like file size limits or supported document types. This leaves significant gaps in understanding 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 structured into clear sections: a purpose statement, 'Args', and 'Returns'. It is front-loaded with the main function and uses bullet-like formatting efficiently. However, the 'Returns' section is vague ('Dictionary with list of images and metadata'), which slightly reduces clarity, but overall, it is concise and well-organized.

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 that there is an output schema (which should detail the return structure), the description does not need to fully explain return values. However, with no annotations and a simple but undocumented parameter, the description provides basic purpose and parameter info but lacks behavioral details and usage context. It is minimally viable but incomplete for optimal agent use.

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 description includes an 'Args' section that names the parameter ('filepath') and a 'Returns' section, but the schema description coverage is 0%, meaning the input schema provides no descriptions. The description adds minimal semantics by indicating 'filepath' is a path to the document, but it does not specify format, examples, or constraints. With one parameter and no schema descriptions, this is adequate but lacks depth.

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: 'List all images in a document.' It specifies the verb ('List') and resource ('images in a document'), making it easy to understand what the tool does. However, it does not explicitly distinguish this tool from sibling tools like 'extract_images' or 'insert_image', which prevents a perfect score.

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 does not mention sibling tools such as 'extract_images' (which might retrieve image files) or 'insert_image' (which adds images), nor does it specify prerequisites or contexts for usage. This lack of comparative information leaves the agent without clear direction.

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