Skip to main content
Glama
hendrickcastro

MCP CosmosDB

mcp_list_containers

Retrieve all containers within a CosmosDB database to analyze structure and manage document storage.

Instructions

List all containers in the CosmosDB database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
random_stringYesDummy parameter for no-parameter tools

Implementation Reference

  • The main asynchronous handler function that lists all containers in the current CosmosDB database, maps their info to ContainerInfo type, and returns ToolResult.
    export const mcp_list_containers = async (): Promise<ToolResult<ContainerInfo[]>> => {
      console.log('Executing mcp_list_containers');
    
      try {
        const database = getDatabase();
        const { resources: containers } = await database.containers.readAll().fetchAll();
        
        const containersInfo: ContainerInfo[] = containers.map((container: any) => ({
          id: container.id,
          partitionKey: container.partitionKey ? {
            paths: container.partitionKey.paths || [],
            kind: container.partitionKey.kind
          } : undefined,
          indexingPolicy: container.indexingPolicy,
          etag: container._etag,
          timestamp: container._ts ? new Date(container._ts * 1000) : undefined
        }));
    
        return { success: true, data: containersInfo };
      } catch (error: any) {
        console.error(`Error in mcp_list_containers: ${error.message}`);
        return { success: false, error: error.message };
      }
  • JSON Schema definition for the tool registration, including input schema (uses dummy param since tool takes no arguments). Used in ListTools response.
    {
      name: "mcp_list_containers",
      description: "List all containers in the CosmosDB database",
      inputSchema: {
        type: "object",
        properties: {
          random_string: {
            type: "string",
            description: "Dummy parameter for no-parameter tools"
          }
        },
        required: ["random_string"]
      }
    },
  • src/server.ts:94-95 (registration)
    Dispatch case in the CallTool request handler that invokes the mcp_list_containers tool handler.
    case 'mcp_list_containers':
        result = await toolHandlers.mcp_list_containers();
  • TypeScript interface defining the structure of ContainerInfo returned in the tool's output.
    export interface ContainerInfo {
      id: string;
      partitionKey?: {
        paths: string[];
        kind?: string;
      };
      throughput?: number;
      indexingPolicy?: any;
      etag?: string;
      timestamp?: Date;
    }
  • src/server.ts:64-66 (registration)
    Registration of the ListTools handler which returns the array of tools including mcp_list_containers with its schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: MCP_COSMOSDB_TOOLS
    }));
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool lists containers but doesn't describe return format, pagination, permissions needed, rate limits, or error conditions. This is inadequate for a tool that likely returns data, leaving significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'containers' means in CosmosDB context, what data is returned, or how results are structured. For a data retrieval tool with rich sibling tools, this leaves too many contextual gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% coverage with one parameter documented as a 'Dummy parameter for no-parameter tools'. The description correctly implies no meaningful parameters are needed by not mentioning any, adding appropriate context beyond the schema. This compensates well for what could otherwise be confusing parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all containers') and the resource ('in the CosmosDB database'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'mcp_list_databases' or 'mcp_container_info', which could cause confusion about when to use each.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'mcp_list_databases' or 'mcp_container_info'. There's no mention of prerequisites, context, or exclusions, leaving the agent without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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