create-bucket
Create a new storage bucket for organizing and managing files in cloud infrastructure, with options to set public or private access.
Instructions
Create new storage bucket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | No | API key for authentication (optional if provided via --api_key) | |
| bucketName | Yes | ||
| isPublic | No |
Implementation Reference
- src/shared/tools.ts:685-719 (handler)Core execution logic for the create-bucket tool: authenticates with API key, sends POST request to backend /api/storage/buckets endpoint with bucketName and isPublic, handles response with formatting and background context, or returns error.withUsageTracking('create-bucket', async ({ apiKey, bucketName, isPublic }) => { try { const actualApiKey = getApiKey(apiKey); const response = await fetch(`${API_BASE_URL}/api/storage/buckets`, { method: 'POST', headers: { 'x-api-key': actualApiKey, 'Content-Type': 'application/json', }, body: JSON.stringify({ bucketName, isPublic } as CreateBucketRequest), }); const result = await handleApiResponse(response); return await addBackgroundContext({ content: [ { type: 'text', text: formatSuccessMessage('Bucket created', result), }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error creating bucket: ${errMsg}`, }, ], isError: true, }; } })
- src/shared/tools.ts:675-720 (registration)MCP server.tool registration for 'create-bucket': specifies name, description, input parameters schema, and references the wrapped handler function.server.tool( 'create-bucket', 'Create new storage bucket', { apiKey: z .string() .optional() .describe('API key for authentication (optional if provided via --api_key)'), ...createBucketRequestSchema.shape, }, withUsageTracking('create-bucket', async ({ apiKey, bucketName, isPublic }) => { try { const actualApiKey = getApiKey(apiKey); const response = await fetch(`${API_BASE_URL}/api/storage/buckets`, { method: 'POST', headers: { 'x-api-key': actualApiKey, 'Content-Type': 'application/json', }, body: JSON.stringify({ bucketName, isPublic } as CreateBucketRequest), }); const result = await handleApiResponse(response); return await addBackgroundContext({ content: [ { type: 'text', text: formatSuccessMessage('Bucket created', result), }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error creating bucket: ${errMsg}`, }, ], isError: true, }; } }) );
- src/shared/tools.ts:678-684 (schema)Input validation schema using Zod: optional apiKey string and spreads createBucketRequestSchema.shape (defines bucketName and isPublic fields). createBucketRequestSchema imported from external package.{ apiKey: z .string() .optional() .describe('API key for authentication (optional if provided via --api_key)'), ...createBucketRequestSchema.shape, },
- src/http/server.ts:129-132 (registration)Registers all Insforge tools (including create-bucket) on the Streamable HTTP MCP server instance.registerInsforgeTools(mcpServer, { apiKey, apiBaseUrl, });
- src/stdio/index.ts:20-23 (registration)Registers all Insforge tools (including create-bucket) on the Stdio MCP server instance.const toolsConfig = registerInsforgeTools(server, { apiKey: api_key, apiBaseUrl: api_base_url || process.env.API_BASE_URL, });