Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

update_module_version

Update an Ansible module's schema, version, and documentation URL in the IAC Memory MCP Server to maintain accurate Infrastructure-as-Code configurations.

Instructions

Update an existing Ansible module's schema and related information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
module_idYesModule ID
new_doc_urlNoNew documentation URL
new_schemaYesNew schema
new_versionNoNew version

Implementation Reference

  • MCP tool handler that calls the database update function and returns the result.
    async def handle_update_module_version( db: Any, arguments: Dict[str, Any], operation_id: str ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: """Handle update_module_version tool.""" try: logger.info( "Updating module version", extra={ "module_id": arguments["module_id"], "new_schema": "...", # Truncated for log "operation_id": operation_id, }, ) # Update module version result = update_module_version( db, arguments["module_id"], arguments["new_schema"], arguments.get("new_version"), arguments.get("new_doc_url"), ) return [TextContent( type="text", text=f"Updated module version: {result}" )] except Exception as e: error_msg = f"Failed to update module version: {str(e)}" logger.error(error_msg, extra={"operation_id": operation_id}) raise McpError( types.ErrorData( code=types.INTERNAL_ERROR, message=error_msg, data={ "tool": "update_module_version", "operation_id": operation_id, }, ) )
  • Input schema validation for the tool parameters.
    "update_module_version": { "type": "object", "description": "Update an existing Ansible module's schema and related information", "required": ["module_id", "new_schema"], "properties": { "module_id": {"type": "string", "description": "Module ID"}, "new_schema": {"type": "string", "description": "New schema"}, "new_version": {"type": "string", "description": "New version"}, "new_doc_url": {"type": "string", "description": "New documentation URL"}, }, },
  • Tool handler registration dictionary mapping tool name to handler function.
    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, }
  • Core database helper function that updates the module schema, version, and documentation in the database.
    def update_module_version( db: DatabaseManager, module_id: str, new_schema: str, new_version: Optional[str] = None, new_doc_url: Optional[str] = None, ) -> bool: """Update an Ansible module's schema and optional fields.""" try: with db.get_connection() as conn: conn.execute("BEGIN IMMEDIATE") # Start transaction try: updates = ["schema = ?"] params = [new_schema] if new_version: updates.append("version = ?") params.append(new_version) if new_doc_url: updates.append("doc_url = ?") params.append(new_doc_url) updates.append("updated_at = CURRENT_TIMESTAMP") params.append(module_id) cursor = conn.execute( f"""UPDATE ansible_modules SET {', '.join(updates)} WHERE id = ?""", tuple(params), ) conn.commit() return cursor.rowcount > 0 except Exception: conn.rollback() raise except sqlite3.Error as e: raise DatabaseError(f"Failed to update module version: {str(e)}")

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