Skip to main content
Glama
AgentWong
by AgentWong

get_collection_version_history

Retrieve version history for a specific Ansible collection to track changes and maintain infrastructure-as-code components.

Instructions

Retrieve version history for a specific Ansible collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_nameYesName of the Ansible collection

Implementation Reference

  • The main handler function that processes the tool call, extracts arguments, calls the DB helper, formats output as TextContent, and handles errors.
    async def handle_get_collection_version_history(
        db: Any, arguments: Dict[str, Any], operation_id: str
    ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """Handle get_collection_version_history tool."""
        try:
            logger.info(
                "Getting collection version history",
                extra={
                    "collection_name": arguments["collection_name"],
                    "operation_id": operation_id,
                },
            )
    
            # Get version history
            versions = get_collection_version_history(db, arguments["collection_name"])
    
            # Format output
            output = [f"Version History for {arguments['collection_name']}:"]
            for v in versions:
                output.append(
                    f"\nVersion: {v['version']}"
                    f"\n  Added: {v['created_at']}"
                    f"\n  Last Updated: {v['updated_at']}"
                    f"\n  Source: {v['source_url']}"
                    f"\n  Docs: {v['doc_url']}"
                )
    
            return [TextContent(type="text", text="\n".join(output))]
    
        except Exception as e:
            error_msg = f"Failed to get collection version history: {str(e)}"
            logger.error(error_msg, extra={"operation_id": operation_id})
            raise McpError(
                types.ErrorData(
                    code=types.INTERNAL_ERROR,
                    message=error_msg,
                    data={
                        "tool": "get_collection_version_history",
                        "operation_id": operation_id,
                    },
                )
            )
  • JSON schema defining the input parameters for the tool, requiring 'collection_name'.
    "get_collection_version_history": {
        "type": "object",
        "description": "Retrieve version history for a specific Ansible collection",
        "required": ["collection_name"],
        "properties": {
            "collection_name": {
                "type": "string",
                "description": "Name of the Ansible collection",
            }
        },
    },
  • Dictionary mapping tool names to their handler functions, registering 'get_collection_version_history' to handle_get_collection_version_history.
    ansible_tool_handlers = {
        "get_ansible_collection_info": handle_get_ansible_collection_info,
        "list_ansible_collections": handle_list_ansible_collections,
        "get_collection_version_history": handle_get_collection_version_history,
        "get_ansible_module_info": handle_get_ansible_module_info,
        "list_collection_modules": handle_list_collection_modules,
        "get_module_version_compatibility": handle_get_module_version_compatibility,
        "add_ansible_collection": handle_add_ansible_collection,
        "add_ansible_module": handle_add_ansible_module,
    }
  • Database helper function that queries the sqlite database for version history of a given Ansible collection and returns list of dicts.
    def get_collection_version_history(
        db: DatabaseManager, collection_name: str
    ) -> List[Dict]:
        """Get version history for a specific Ansible collection.
    
        Args:
            db: Database manager instance
            collection_name: Name of the collection
    
        Returns:
            List of version entries with timestamps and URLs
        """
        logger.info(
            "Getting collection version history",
            extra={
                "collection_name": collection_name,
                "operation": "get_collection_version_history",
            },
        )
    
        try:
            with db.get_connection() as conn:
                conn.execute("PRAGMA busy_timeout = 5000")  # 5 second timeout
    
                versions = conn.execute(
                    """
                    SELECT version, source_url, doc_url, created_at, updated_at
                    FROM ansible_collections
                    WHERE name = ?
                    ORDER BY created_at DESC
                    """,
                    (collection_name,),
                ).fetchall()
    
                if not versions:
                    raise DatabaseError(f"Collection '{collection_name}' not found")
    
                return [dict(v) for v in versions]
    
        except sqlite3.Error as e:
            error_msg = f"Failed to get collection version history: {str(e)}"
            logger.error(error_msg)
            raise DatabaseError(error_msg)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Retrieve' suggests a read-only operation, it doesn't specify whether this requires authentication, has rate limits, returns paginated results, or what the output format looks like. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized for a single-parameter tool and front-loads the essential information without unnecessary elaboration.

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?

For a read-only tool with one fully documented parameter, the description adequately covers the basic purpose. However, with no annotations and no output schema, it should ideally provide more context about behavioral aspects (like authentication needs or return format) to be truly complete. The current description meets minimum viable standards but has clear gaps.

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 100%, so the schema already fully documents the single 'collection_name' parameter. The description doesn't add any additional meaning beyond what's in the schema (e.g., format examples, constraints, or relationship to other parameters). Baseline 3 is appropriate when the schema does all the parameter documentation work.

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

Purpose5/5

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

The description clearly states the specific action ('Retrieve version history') and target resource ('for a specific Ansible collection'), distinguishing it from siblings like 'get_ansible_collection_info' (general info) and 'update_collection_version' (modification). It uses precise terminology that matches the tool's domain context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when version history is needed for an Ansible collection, but doesn't explicitly state when to choose this tool over alternatives like 'get_ansible_collection_info' or 'get_provider_version_history' (for Terraform). No guidance on prerequisites or exclusions is provided, leaving usage context somewhat ambiguous.

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/AgentWong/iac-memory-mcp-server-project'

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