Skip to main content
Glama
AgentWong

IAC Memory MCP Server

by AgentWong

update_module_version

Update an existing Ansible module's schema, version, and documentation URL in the Infrastructure-as-Code memory cache.

Instructions

Update an existing Ansible module's schema and related information

Input Schema

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

Implementation Reference

  • MCP tool handler that validates arguments, calls the database update function, logs the operation, and returns success/error messages.
    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,
                    },
                )
            )
  • JSON schema defining the input parameters for the update_module_version tool, including required fields like module_id and new_schema.
    "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"},
        },
    },
  • Dictionary mapping tool names to their handler functions, registering update_module_version with its handler.
    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 performs the SQL UPDATE on the ansible_modules table to update schema, version, doc_url, and timestamp.
    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)}")
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'update' implies a mutation, the description doesn't specify permissions needed, whether changes are reversible, potential side effects, or response format. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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's appropriately sized and front-loaded, making it easy to parse 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 this is a mutation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits, error handling, or return values, which are critical for safe and effective use. The high schema coverage doesn't compensate for these gaps in context.

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 input schema already documents all four parameters (module_id, new_schema, new_version, new_doc_url) with basic descriptions. The description doesn't add any meaningful context beyond what the schema provides, such as format examples or constraints, so it meets the baseline for high schema coverage.

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 action ('update') and resource ('existing Ansible module's schema and related information'), making the purpose understandable. However, it doesn't explicitly differentiate this tool from similar sibling tools like 'update_collection_version' or 'update_resource_schema', which would require more specific language about what makes this tool unique for Ansible modules.

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. With multiple update-related sibling tools (e.g., 'update_collection_version', 'update_entity'), there's no indication of prerequisites, context, or exclusions. This leaves the agent without clear direction on tool selection.

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