Skip to main content
Glama
hendrickcastro

MCP CosmosDB

mcp_get_container_definition

Retrieve comprehensive configuration details of an Azure CosmosDB container, including partition key, indexing policy, and throughput settings. Use this to understand container structure before writing queries.

Instructions

Get detailed configuration of a specific container including partition key, indexing policy, and throughput settings. Use this to understand the container structure before writing queries. Example: mcp_get_container_definition({container_id: 'users', connection_id: 'athlete'})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
container_idYesThe ID/name of the container (e.g., 'users', 'orders', 'products')
connection_idNoID of the connection to use. Use mcp_list_connections to see available connections. If not specified, uses the default connection.

Implementation Reference

  • Main handler function for mcp_get_container_definition. Reads container definition (partition key, indexing policy, etag, timestamp) and throughput settings via CosmosDB SDK's container.read() and container.readOffer(). Returns ContainerInfo with throughput data.
    export const mcp_get_container_definition = async (args: { container_id: string; connection_id?: string }): Promise<ToolResult<ContainerInfo & { throughputInfo?: any }>> => {
      const { container_id, connection_id } = args;
      log(`Executing mcp_get_container_definition with: ${JSON.stringify(args)}`);
    
      try {
        const container = getContainer(container_id, connection_id);
        
        // Read container definition
        const { resource: containerDef } = await container.read();
        
        // Try to read throughput settings
        let throughputInfo;
        try {
          const offerResponse = await container.readOffer();
          throughputInfo = offerResponse.resource;
        } catch (offerError) {
          // Throughput might not be defined for shared throughput containers
          log('Could not read container throughput (might use shared database throughput)');
        }
    
        if (!containerDef) {
          throw new Error(`Container ${container_id} not found`);
        }
    
        const containerInfo: ContainerInfo & { throughputInfo?: any } = {
          id: containerDef.id,
          partitionKey: containerDef.partitionKey ? {
            paths: containerDef.partitionKey.paths || [],
            kind: containerDef.partitionKey.kind
          } : undefined,
          indexingPolicy: containerDef.indexingPolicy,
          etag: containerDef._etag,
          timestamp: containerDef._ts ? new Date(containerDef._ts * 1000) : undefined,
          throughputInfo
        };
    
        return { success: true, data: containerInfo };
      } catch (error: any) {
        log(`Error in mcp_get_container_definition for container ${container_id}: ${error.message}`);
        return { success: false, error: error.message };
      }
    };
  • Input schema definition for mcp_get_container_definition. Declares the tool name, description, and inputSchema requiring container_id (string) and optional connection_id.
    // 3. Container Information
    {
      name: "mcp_get_container_definition",
      description: "Get detailed configuration of a specific container including partition key, indexing policy, and throughput settings. Use this to understand the container structure before writing queries. Example: mcp_get_container_definition({container_id: 'users', connection_id: 'athlete'})",
      inputSchema: {
        type: "object",
        properties: {
          container_id: {
            type: "string",
            description: "The ID/name of the container (e.g., 'users', 'orders', 'products')"
          },
          ...connectionIdProperty
        },
        required: ["container_id"]
      }
    },
  • src/server.ts:126-129 (registration)
    Registration in the server's CallToolRequestHandler. Routes the 'mcp_get_container_definition' tool name to the handler function via toolHandlers.mcp_get_container_definition().
    // Container information
    case 'mcp_get_container_definition':
        result = await toolHandlers.mcp_get_container_definition(input as any);
        break;
  • src/tools/index.ts:4-9 (registration)
    Re-exports mcp_get_container_definition from containerAnalysis.ts in the central tools index barrel file.
    export {
      mcp_list_databases,
      mcp_list_containers,
      mcp_get_container_definition,
      mcp_get_container_stats
    } from './containerAnalysis.js';
  • ContainerInfo interface used as the shape of the returned data. Includes id, partitionKey (paths and kind), indexingPolicy, etag, and timestamp fields.
    export interface ContainerInfo {
      id: string;
      partitionKey?: {
        paths: string[];
        kind?: string;
      };
      throughput?: number;
      indexingPolicy?: any;
      etag?: string;
      timestamp?: Date;
    }
Behavior3/5

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

No annotations provided, and the description does not explicitly state read-only or safety. However, the name 'get' and the description imply a read operation, which is adequate.

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?

One concise paragraph with an example, no fluff. Every sentence adds value.

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

Completeness5/5

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

Description explains what the tool returns (partition key, indexing policy, throughput) despite no output schema. For a 2-parameter tool, this is complete.

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

Parameters3/5

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

Input schema has 100% description coverage, so the description adds little beyond the schema. The example usage provides some extra context for parameter values.

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

Purpose5/5

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

Description clearly states the tool gets detailed configuration of a specific container, listing specific items like partition key, indexing policy, and throughput. It distinguishes from sibling tools like mcp_list_containers and mcp_get_container_stats by focusing on a single container's detailed config.

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

Usage Guidelines4/5

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

Explicitly says 'Use this to understand the container structure before writing queries', providing clear context. Does not explicitly mention when not to use or alternatives, but the purpose is well-scoped.

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