delete_database
Remove a specified database from your Turso organization using the MCP server for precise and secure database management.
Instructions
Delete a database from your Turso organization
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the database to delete |
Implementation Reference
- src/clients/organization.ts:121-150 (handler)The core handler function that performs the actual DELETE API request to the Turso platform to delete the specified database.export async function delete_database(name: string): Promise<void> { const organization_id = get_organization_id(); const url = `${API_BASE_URL}/organizations/${organization_id}/databases/${name}`; try { const response = await fetch(url, { method: 'DELETE', headers: get_auth_header(), }); if (!response.ok) { const errorData = await response.json().catch(() => ({})); const errorMessage = errorData.error || response.statusText; throw new TursoApiError( `Failed to delete database ${name}: ${errorMessage}`, response.status, ); } } catch (error) { if (error instanceof TursoApiError) { throw error; } throw new TursoApiError( `Failed to delete database ${name}: ${ (error as Error).message }`, 500, ); } }
- src/tools/handler.ts:140-157 (registration)Registers the 'delete_database' tool with the MCP server using server.tool(), providing name, description, input schema, and a thin wrapper handler that calls the organization client implementation.server.tool( { name: 'delete_database', description: `⚠️ DESTRUCTIVE: Permanently deletes a database and ALL its data. Cannot be undone. Always confirm with user before proceeding and verify correct database name.`, schema: DeleteDatabaseSchema, }, async ({ name }) => { try { await organization_client.delete_database(name); return create_tool_response({ success: true, message: `Database '${name}' deleted successfully`, }); } catch (error) { return create_tool_error_response(error); } }, );
- src/tools/handler.ts:23-25 (schema)Zod schema definition for the delete_database tool input, validating the 'name' parameter with description.const DeleteDatabaseSchema = z.object({ name: z.string().describe('Name of the database to permanently delete - WARNING: ALL DATA WILL BE LOST FOREVER'), });