Skip to main content
Glama

mcp_list_databases

Retrieve a list of all databases in your Azure CosmosDB account to manage and analyze your document storage resources.

Instructions

List all databases in the CosmosDB account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
random_stringYesDummy parameter for no-parameter tools

Implementation Reference

  • The handler function that executes the logic to list all databases in the CosmosDB account using the client API.
    export const mcp_list_databases = async (): Promise<ToolResult<DatabaseInfo[]>> => { console.log('Executing mcp_list_databases'); try { const database = getDatabase(); const client = database.client; const { resources: databases } = await client.databases.readAll().fetchAll(); const databasesInfo: DatabaseInfo[] = databases.map(db => ({ id: db.id, etag: db._etag, timestamp: new Date(db._ts * 1000) })); return { success: true, data: databasesInfo }; } catch (error: any) { console.error(`Error in mcp_list_databases: ${error.message}`); return { success: false, error: error.message }; } };
  • src/tools.ts:4-16 (registration)
    Tool registration in MCP_COSMOSDB_TOOLS array, defining name, description, and input schema for the MCP ListTools request.
    name: "mcp_list_databases", description: "List all databases in the CosmosDB account", inputSchema: { type: "object", properties: { random_string: { type: "string", description: "Dummy parameter for no-parameter tools" } }, required: ["random_string"] } },
  • TypeScript interface defining the structure of DatabaseInfo returned by the tool.
    export interface DatabaseInfo { id: string; throughput?: number; etag: string; timestamp: Date; }
  • Type definitions for tool results, used as return type for the handler.
    export type ToolSuccessResult<T> = { success: true; data: T; }; export type ToolErrorResult = { success: false; error: string; }; export type ToolResult<T> = ToolSuccessResult<T> | ToolErrorResult;
  • src/server.ts:91-92 (registration)
    Dispatch/registration in the CallTool handler switch statement that invokes the tool handler.
    case 'mcp_list_databases': result = await toolHandlers.mcp_list_databases();

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/hendrickcastro/MCPCosmosDB'

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