list_databases
Retrieve a complete list of all databases within your Turso organization. This tool enables quick access and management of database information directly from the mcp-turso-cloud server.
Instructions
List all databases in your Turso organization
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/handler.ts:106-119 (handler)MCP tool handler and registration for 'list_databases'. Defines the tool with empty input schema and executes by calling the organization client to list databases, returning formatted response or error.{ name: 'list_databases', description: 'List all databases in your Turso organization', schema: EmptySchema, }, async () => { try { const databases = await organization_client.list_databases(); return create_tool_response({ databases }); } catch (error) { return create_tool_error_response(error); } }, );
- src/tools/handler.ts:15-15 (schema)Zod schema for tools with no input parameters, used by list_databases tool.const EmptySchema = z.object({});
- src/clients/organization.ts:30-63 (helper)Helper function that implements the core logic to list databases by making an authenticated GET request to the Turso Platform API.export async function list_databases(): Promise<Database[]> { const organization_id = get_organization_id(); const url = `${API_BASE_URL}/organizations/${organization_id}/databases`; try { const response = await fetch(url, { method: 'GET', headers: { ...get_auth_header(), 'Content-Type': 'application/json', }, }); if (!response.ok) { const errorData = await response.json().catch(() => ({})); const errorMessage = errorData.error || response.statusText; throw new TursoApiError( `Failed to list databases: ${errorMessage}`, response.status, ); } const data = await response.json(); return data.databases || []; } catch (error) { if (error instanceof TursoApiError) { throw error; } throw new TursoApiError( `Failed to list databases: ${(error as Error).message}`, 500, ); } }