Skip to main content
Glama

delete_object

Remove a specific object from a Cloud Storage bucket on GCP by specifying the project ID, bucket name, and file name. Streamlines storage management directly through natural language commands.

Instructions

Delete an object from a Cloud Storage bucket. Args: project_id: The ID of the GCP project bucket_name: The name of the bucket to delete from blob_name: The name of the file to delete Returns: Result of the delete operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blob_nameYes
bucket_nameYes
project_idYes

Implementation Reference

  • The main handler function for the 'delete_object' tool. It is decorated with @mcp.tool() for registration and implements the logic to delete a blob from a GCP Cloud Storage bucket using the google.cloud.storage library. Includes input parameters, docstring schema, and error handling.
    @mcp.tool() def delete_object(project_id: str, bucket_name: str, blob_name: str) -> str: """ Delete an object from a Cloud Storage bucket. Args: project_id: The ID of the GCP project bucket_name: The name of the bucket to delete from blob_name: The name of the file to delete Returns: Result of the delete operation """ try: from google.cloud import storage # Initialize the Storage client client = storage.Client(project=project_id) # Get the bucket bucket = client.get_bucket(bucket_name) # Delete the blob blob = bucket.blob(blob_name) blob.delete() return f"Object gs://{bucket_name}/{blob_name} has been successfully deleted." except Exception as e: return f"Error deleting object: {str(e)}"
  • Invocation of the storage module's register_tools function within the main server.py, which registers the 'delete_object' tool (and other storage tools) with the MCP server instance.
    storage_tools.register_tools(mcp)
  • Import of the storage tools module in the main server.py, enabling the registration of the 'delete_object' tool.
    from .gcp_modules.storage import tools as storage_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/henihaddad/gcp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server