mcp_container_info
Retrieve detailed container information, including throughput settings, by specifying the container ID within MCP CosmosDB for efficient database analysis.
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-100 (handler)The main execution function for the mcp_container_info tool. It fetches detailed container properties like partition key, indexing policy, throughput info, etag, and timestamp from CosmosDB.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:35-48 (schema)The JSON schema definition for the mcp_container_info tool, including input parameters (container_id) used for validation and tool listing.{ 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/server.ts:97-98 (registration)The dispatch/registration point in the MCP server where the mcp_container_info handler is invoked based on tool name.case 'mcp_container_info': result = await toolHandlers.mcp_container_info(input as any);
- src/tools/index.ts:4-9 (registration)Re-export of the mcp_container_info handler from containerAnalysis.ts, enabling modular imports.export { mcp_list_databases, mcp_list_containers, mcp_container_info, mcp_container_stats } from './containerAnalysis.js';
- src/mcp-server.ts:2-2 (registration)Re-export aggregator that makes mcp_container_info available via toolHandlers import in server.ts.export * from './tools/index.js';