Skip to main content
Glama

mcp_list_databases

Retrieve a complete list of databases within a CosmosDB account using the MCP CosmosDB server tool for efficient database management and analysis.

Instructions

List all databases in the CosmosDB account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
random_stringYesDummy parameter for no-parameter tools

Implementation Reference

  • The main handler function that lists all databases in the CosmosDB account using the client.databases.readAll() method.
    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 }; } };
  • The tool schema definition, part of MCP_COSMOSDB_TOOLS array, including name, description, and input schema with a dummy parameter.
    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"] } },
  • src/tools/index.ts:4-5 (registration)
    Export of the mcp_list_databases handler from containerAnalysis.js, making it available for import.
    export { mcp_list_databases,
  • src/server.ts:91-92 (registration)
    Dispatch/registration in the tool call handler switch statement, calling the toolHandlers.mcp_list_databases().
    case 'mcp_list_databases': result = await toolHandlers.mcp_list_databases();
  • src/mcp-server.ts:1-2 (registration)
    Re-export of all tools from tools/index.js, imported as toolHandlers in server.ts.
    // Import all tools from the modular structure export * from './tools/index.js';

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

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