Skip to main content
Glama

get_collection_version_history

Track and retrieve the version history of an Ansible collection to monitor changes and updates over time. Ideal for managing Infrastructure-as-Code resources effectively.

Instructions

Retrieve version history for a specific Ansible collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_nameYesName of the Ansible collection

Implementation Reference

  • The MCP tool handler function that processes the tool call, retrieves version history from the database, formats it, and returns as TextContent.
    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, }, ) )
  • Database helper function that queries the SQLite database for all versions of the specified Ansible collection, ordered by creation date descending.
    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)
  • JSON schema definition for the tool's input parameters, 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", } }, },
  • Registration of the handler function in the ansible_tool_handlers dictionary, used for tool dispatching.
    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, }

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