update_resource_schema
Modify the schema, version, and documentation URL of a Terraform resource within the IaC Memory MCP Server, enabling accurate updates for resource configurations.
Instructions
Update an existing Terraform resource's schema and related information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new_doc_url | No | New documentation URL | |
| new_schema | Yes | New schema | |
| new_version | No | New version | |
| resource_id | Yes | Resource ID |
Implementation Reference
- The main handler function that executes the database update operation for updating a Terraform resource schema, including optional version and documentation updates.def update_resource_schema( db: DatabaseManager, resource_id: str, new_schema: str, new_version: Optional[str] = None, new_doc_url: Optional[str] = None, ) -> bool: """Update a Terraform resource's schema and optional fields.""" logger.info( "Updating resource schema", extra={ "resource_id": resource_id, "has_new_version": bool(new_version), "has_new_doc_url": bool(new_doc_url), "operation": "update_resource_schema", }, ) 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(resource_id) with db.get_connection() as conn: cursor = conn.execute( f"""UPDATE terraform_resources SET {', '.join(updates)} WHERE id = ?""", tuple(params), ) return cursor.rowcount > 0 except sqlite3.Error as e: error_msg = f"Failed to update resource schema: {str(e)}" logger.error(error_msg) raise DatabaseError(error_msg)
- The JSON schema defining the input parameters and validation rules for the update_resource_schema tool."update_resource_schema": { "type": "object", "description": "Update an existing Terraform resource's schema and related information", "required": ["resource_id", "new_schema"], "properties": { "resource_id": {"type": "string", "description": "Resource ID"}, "new_schema": {"type": "string", "description": "New schema"}, "new_version": {"type": "string", "description": "New version"}, "new_doc_url": {"type": "string", "description": "New documentation URL"}, }, },
- src/iac_memory_mcp_server/db/__init__.py:29-36 (registration)Package-level import and re-export of the update_resource_schema function, making it available throughout the db module.add_terraform_provider, add_terraform_resource, get_provider_resources, get_resource_info, update_provider_version, update_resource_schema, )