delete-bucket
Remove a storage bucket from the Insforge backend service to free up resources and manage your cloud storage infrastructure.
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:773-805 (handler)Core handler function that performs the DELETE API request to remove the specified storage bucket, handles the response, formats success/error messages, and wraps the result with background context.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:766-772 (schema)Zod input schema defining parameters: optional apiKey (string) and required bucketName (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:763-806 (registration)Registers the 'delete-bucket' tool on the MCP server with name, description, input schema, and handler wrapped in usage tracking.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, }; } }) );