blob_container_delete
Remove a Blob Storage container from Azure using the Model Context Protocol, ensuring automatic logging and audit tracking for the deletion operation. Input the container name to execute.
Instructions
Delete a Blob Storage container
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| container_name | Yes | Name of the Blob Storage container to delete |
Input Schema (JSON Schema)
{
"properties": {
"container_name": {
"description": "Name of the Blob Storage container to delete",
"type": "string"
}
},
"required": [
"container_name"
],
"type": "object"
}
Implementation Reference
- mcp_server_azure/azure_server.py:196-198 (handler)Executes the blob container deletion using the BlobServiceClient's delete_container method.elif name == "blob_container_delete": blob_service_client.delete_container(arguments["container_name"]) response = {"container_name": arguments["container_name"], "deleted": True}
- Defines the input schema for the blob_container_delete tool, requiring 'container_name'.Tool( name="blob_container_delete", description="Delete a Blob Storage container", inputSchema={ "type": "object", "properties": { "container_name": { "type": "string", "description": "Name of the Blob Storage container to delete", } }, "required": ["container_name"], }, ),
- mcp_server_azure/azure_server.py:172-176 (registration)Registers the blob_container_delete tool (among others) by returning get_azure_tools() in the list_tools handler.async def list_tools() -> list[Tool]: """List available Azure tools""" logger.debug("Handling list_tools request") return get_azure_tools() # Use get_azure_tools
- Shared handler function for all blob storage tools, including the dispatch and execution for blob_container_delete.async def handle_blob_storage_operations( azure_rm: AzureResourceManager, name: str, arguments: dict ) -> list[TextContent]: """Handle Azure Blob Storage operations""" blob_service_client = azure_rm.get_blob_service_client() response = None if name == "blob_container_create": container_client = blob_service_client.create_container( arguments["container_name"] ) response = { "container_name": container_client.container_name, "created": True, } # Simplify response elif name == "blob_container_list": containers = blob_service_client.list_containers() container_names = [container.name for container in containers] response = {"container_names": container_names} elif name == "blob_container_delete": blob_service_client.delete_container(arguments["container_name"]) response = {"container_name": arguments["container_name"], "deleted": True} elif name == "blob_upload": blob_client = blob_service_client.get_blob_client( container=arguments["container_name"], blob=arguments["blob_name"] ) decoded_content = base64.b64decode(arguments["file_content"]) blob_client.upload_blob(decoded_content, overwrite=True) response = {"blob_name": arguments["blob_name"], "uploaded": True} elif name == "blob_delete": blob_client = blob_service_client.get_blob_client( container=arguments["container_name"], blob=arguments["blob_name"] ) blob_client.delete_blob() response = {"blob_name": arguments["blob_name"], "deleted": True} elif name == "blob_list": container_client = blob_service_client.get_container_client( arguments["container_name"] ) blob_list = container_client.list_blobs() blob_names = [blob.name for blob in blob_list] response = {"blob_names": blob_names} elif name == "blob_read": blob_client = blob_service_client.get_blob_client( container=arguments["container_name"], blob=arguments["blob_name"] ) downloader = blob_client.download_blob() content = downloader.readall().decode("utf-8") return [TextContent(type="text", text=content)] else: raise ValueError(f"Unknown Blob Storage operation: {name}") azure_rm.log_operation( "blob_storage", name.replace("blob_", ""), arguments ) # Update service name in log return [ TextContent( type="text", text=f"Operation Result:\n{json.dumps(response, indent=2, default=custom_json_serializer)}", ) ]