Skip to main content
Glama

mcp_get_document_by_id

Retrieve a specific document from an Azure CosmosDB container using its ID and partition key for precise data access and analysis.

Instructions

Get a specific document by its ID and partition key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
container_idYesThe ID of the container
document_idYesThe ID of the document to retrieve
partition_keyYesThe partition key value for the document

Implementation Reference

  • The main execution function (handler) for the mcp_get_document_by_id tool. It retrieves a specific document from a CosmosDB container using the provided container_id, document_id, and partition_key.
    export const mcp_get_document_by_id = async (args: { container_id: string; document_id: string; partition_key: string; }): Promise<ToolResult<DocumentInfo>> => { const { container_id, document_id, partition_key } = args; console.log('Executing mcp_get_document_by_id with:', args); try { const container = getContainer(container_id); const { resource: document } = await container.item(document_id, partition_key).read(); return { success: true, data: document }; } catch (error: any) { console.error(`Error in mcp_get_document_by_id for document ${document_id}: ${error.message}`); return { success: false, error: error.message }; } };
  • The tool definition including name, description, and inputSchema used for validation and MCP tool listing.
    { name: "mcp_get_document_by_id", description: "Get a specific document by its ID and partition key", inputSchema: { type: "object", properties: { container_id: { type: "string", description: "The ID of the container" }, document_id: { type: "string", description: "The ID of the document to retrieve" }, partition_key: { type: "string", description: "The partition key value for the document" } }, required: ["container_id", "document_id", "partition_key"] } },
  • src/server.ts:109-111 (registration)
    The dispatch case in the CallToolRequestSchema handler that specifically routes calls to this tool's handler function.
    case 'mcp_get_document_by_id': result = await toolHandlers.mcp_get_document_by_id(input as any); break;

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