delete-bucket
Remove a storage bucket from the Insforge MCP Server to manage cloud storage resources. Specify the bucket name to delete it permanently.
Instructions
Deletes a storage bucket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | No | API key for authentication (optional if provided via --api_key) | |
| bucketName | Yes | Name of the bucket to delete |
Implementation Reference
- src/shared/tools.ts:770-802 (handler)The core handler logic for the 'delete-bucket' tool. It performs a DELETE request to the storage API endpoint using the provided bucket name and API key, handles the response, and returns formatted success or error messages.withUsageTracking('delete-bucket', async ({ apiKey, bucketName }) => { try { const actualApiKey = getApiKey(apiKey); const response = await fetch(`${API_BASE_URL}/api/storage/buckets/${bucketName}`, { method: 'DELETE', headers: { 'x-api-key': actualApiKey, }, }); const result = await handleApiResponse(response); return await addBackgroundContext({ content: [ { type: 'text', text: formatSuccessMessage('Bucket deleted', result), }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error deleting bucket: ${errMsg}`, }, ], isError: true, }; } })
- src/shared/tools.ts:763-769 (schema)Zod schema defining the input parameters: apiKey (optional string) and bucketName (required string).{ apiKey: z .string() .optional() .describe('API key for authentication (optional if provided via --api_key)'), bucketName: z.string().describe('Name of the bucket to delete'), },
- src/shared/tools.ts:760-803 (registration)The server.tool() call that registers the 'delete-bucket' tool, specifying its name, description, input schema, and handler function.server.tool( 'delete-bucket', 'Deletes a storage bucket', { apiKey: z .string() .optional() .describe('API key for authentication (optional if provided via --api_key)'), bucketName: z.string().describe('Name of the bucket to delete'), }, withUsageTracking('delete-bucket', async ({ apiKey, bucketName }) => { try { const actualApiKey = getApiKey(apiKey); const response = await fetch(`${API_BASE_URL}/api/storage/buckets/${bucketName}`, { method: 'DELETE', headers: { 'x-api-key': actualApiKey, }, }); const result = await handleApiResponse(response); return await addBackgroundContext({ content: [ { type: 'text', text: formatSuccessMessage('Bucket deleted', result), }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error deleting bucket: ${errMsg}`, }, ], isError: true, }; } }) );