Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

get_collection_version_history

Retrieve version history for an Ansible collection to track changes and manage infrastructure-as-code updates.

Instructions

Retrieve version history for a specific Ansible collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_nameYesName of the Ansible collection

Implementation Reference

  • Handler function that executes the get_collection_version_history tool logic. Logs the request, fetches version history from DB, formats as text output, 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 definition for the get_collection_version_history tool input parameters.
    "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",
            }
        },
    },
  • Registration of the tool handler in the ansible_tool_handlers dictionary.
    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,
        "update_collection_version": handle_update_collection_version,
        "update_module_version": handle_update_module_version,
    }
  • Database helper function that queries the version history for a given Ansible collection from the database.
    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 the full burden of behavioral disclosure. It states the action but fails to describe key traits like whether it's read-only, requires authentication, has rate limits, returns paginated results, or what the output format entails, which is insufficient for a tool with no annotation coverage.

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 without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It does not address behavioral aspects, output details, or usage context, which are critical for a tool that retrieves historical data. This leaves significant gaps in understanding how to effectively use the 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?

The schema description coverage is 100%, so the schema already documents the single parameter 'collection_name'. The description does not add any additional meaning or context beyond what the schema provides, such as format examples or constraints, resulting in a baseline 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 'Retrieve' and the resource 'version history for a specific Ansible collection', making the purpose evident. However, it does not explicitly differentiate from sibling tools like 'get_provider_version_history' or 'get_ansible_collection_info', which reduces clarity in a multi-tool context.

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 'get_ansible_collection_info' or 'list_ansible_collections'. It lacks context on prerequisites, exclusions, or specific scenarios, leaving usage 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'

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