update_collection_version
Update version details and documentation links for an existing Ansible collection to maintain accurate version tracking and resource mapping in the IaC Memory MCP Server.
Instructions
Update an existing Ansible collection's version information and documentation links
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_id | Yes | Collection ID | |
| new_doc_url | No | New documentation URL | |
| new_source_url | No | New source URL | |
| new_version | Yes | New version |
Implementation Reference
- Core handler function that executes the database update logic for updating an Ansible collection's version and optional source/doc URLs.def update_collection_version( db: DatabaseManager, collection_id: str, new_version: str, new_source_url: Optional[str] = None, new_doc_url: Optional[str] = None, ) -> bool: """Update an Ansible collection's version and optional URLs.""" try: updates = ["version = ?"] params = [new_version] if new_source_url: updates.append("source_url = ?") params.append(new_source_url) if new_doc_url: updates.append("doc_url = ?") params.append(new_doc_url) updates.append("updated_at = CURRENT_TIMESTAMP") params.append(collection_id) with db.get_connection() as conn: # Set busy timeout before any operations conn.execute( "PRAGMA busy_timeout = 5000" ) # 5 second timeout per testing rules conn.execute("BEGIN IMMEDIATE") # Start transaction try: cursor = conn.execute( f"""UPDATE ansible_collections SET {', '.join(updates)} WHERE id = ?""", tuple(params), ) success = cursor.rowcount > 0 conn.commit() return success except Exception: conn.rollback() raise except sqlite3.Error as e: raise DatabaseError( f"Failed to update collection version: {str(e)}. " f"Operation timed out after 5 seconds." )
- JSON schema defining the input parameters and validation for the update_collection_version tool."update_collection_version": { "type": "object", "description": "Update an existing Ansible collection's version information and documentation links", "required": ["collection_id", "new_version"], "properties": { "collection_id": {"type": "string", "description": "Collection ID"}, "new_version": {"type": "string", "description": "New version"}, "new_source_url": {"type": "string", "description": "New source URL"}, "new_doc_url": {"type": "string", "description": "New documentation URL"}, }, },
- src/iac_memory_mcp_server/db/__init__.py:3-10 (registration)Export of the update_collection_version function in the db package __init__.py, making it available for tool registration.from .ansible import ( add_ansible_collection, add_ansible_module, get_collection_modules, get_module_info, update_collection_version, update_module_version, )
- Wrapper method on DatabaseManager that delegates to the core ansible.py implementation.def update_collection_version( self, collection_id: str, new_version: str, new_source_url: str = None, new_doc_url: str = None, ) -> bool: """Update a collection's version.""" from .ansible import update_collection_version return update_collection_version( self, collection_id, new_version, new_source_url, new_doc_url )