mcp_container_info
Retrieve detailed container information and throughput settings for Azure CosmosDB to analyze database performance and configuration.
Instructions
Get detailed information about a specific container including throughput settings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| container_id | Yes | The ID of the container to analyze |
Implementation Reference
- src/tools/containerAnalysis.ts:60-101 (handler)The async function implementing the core logic of the mcp_container_info tool. It retrieves detailed container information including partition key, indexing policy, etag, timestamp, and optional throughput settings from the CosmosDB container.export const mcp_container_info = async (args: { container_id: string }): Promise<ToolResult<ContainerInfo & { throughputInfo?: any }>> => { const { container_id } = args; console.log('Executing mcp_container_info with:', args); try { const container = getContainer(container_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 console.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) { console.error(`Error in mcp_container_info for container ${container_id}: ${error.message}`); return { success: false, error: error.message }; } };
- src/tools.ts:36-48 (schema)MCP tool metadata definition including name, description, and input schema for validation, used in ListTools response.name: "mcp_container_info", description: "Get detailed information about a specific container including throughput settings", inputSchema: { type: "object", properties: { container_id: { type: "string", description: "The ID of the container to analyze" } }, required: ["container_id"] } },
- src/tools/types.ts:14-24 (schema)TypeScript interface defining the structure of ContainerInfo data returned by the tool.export interface ContainerInfo { id: string; partitionKey?: { paths: string[]; kind?: string; }; throughput?: number; indexingPolicy?: any; etag?: string; timestamp?: Date; }
- src/server.ts:97-99 (registration)Switch case in the MCP CallTool request handler that invokes the mcp_container_info tool handler.case 'mcp_container_info': result = await toolHandlers.mcp_container_info(input as any); break;
- src/tools/index.ts:4-9 (registration)Re-export of the mcp_container_info handler function from containerAnalysis.ts, making it available for import in mcp-server.ts.export { mcp_list_databases, mcp_list_containers, mcp_container_info, mcp_container_stats } from './containerAnalysis.js';