Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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);
    		}
    	},
    );
  • Zod schema for tools with no input parameters, used by list_databases tool.
    const EmptySchema = z.object({});
  • 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,
    		);
    	}
    }
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