Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYesName of the database to delete

Implementation Reference

  • 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,
    		);
    	}
    }
  • 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);
    		}
    	},
    );
  • 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'),
    });

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related 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/spences10/mcp-turso-cloud'

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