Skip to main content
Glama
robinong79

Azure Cosmos DB MCP Server

by robinong79

get_item

Retrieve a specific item from an Azure Cosmos DB container using its unique ID. Ideal for fetching targeted data entries directly through the MCP server interface.

Instructions

Retrieves an item from a Azure Cosmos DB container by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
containerNameYesName of the container
idYesID of the item to retrieve

Implementation Reference

  • The core handler function for the get_item tool that retrieves an item from the hardcoded Cosmos DB container by ID using container.item(id).read(). Note: ignores containerName parameter.
    async function getItem(params: any) {
      try {
        const { id } = params;
        const { resource } = await container.item(id).read();
    
        return {
          success: true,
          message: `Item retrieved successfully`,
          item: resource,
        };
      } catch (error) {
        console.error("Error getting item:", error);
        return {
          success: false,
          message: `Failed to get item: ${error}`,
        };
      }
    }
  • The tool schema definition for get_item, specifying input parameters containerName and id.
    const GET_ITEM_TOOL: Tool = {
      name: "get_item",
      description: "Retrieves an item from a Azure Cosmos DB container by its ID",
      inputSchema: {
        type: "object",
        properties: {
          containerName: { type: "string", description: "Name of the container" },
          id: { type: "string", description: "ID of the item to retrieve" },
        },
        required: ["containerName", "id"],
      },
    };
  • src/index.ts:177-179 (registration)
    Registration of the get_item tool (via GET_ITEM_TOOL) in the ListToolsRequestHandler, making it discoverable.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [PUT_ITEM_TOOL, GET_ITEM_TOOL, QUERY_CONTAINER_TOOL, UPDATE_ITEM_TOOL],
    }));
  • src/index.ts:190-192 (registration)
    Dispatch/registration of the get_item tool call in the switch statement of CallToolRequestHandler.
    case "get_item":
      result = await getItem(args);
      break;
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 this is a retrieval operation but doesn't mention error handling (e.g., what happens if container doesn't exist or ID is invalid), authentication requirements, rate limits, or whether this is a read-only operation. The description is minimal and lacks important behavioral context.

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 gets straight to the point with zero waste. It's appropriately sized for a simple retrieval operation and front-loads the essential information.

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?

For a database retrieval tool with no annotations and no output schema, the description is insufficient. It doesn't explain what format the item is returned in, error conditions, authentication needs, or how this differs from sibling tools. The description should provide more context given the complexity of database operations.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('containerName' and 'id'). The description adds minimal value by mentioning these parameters in context ('by its ID'), but doesn't provide additional semantics beyond what the schema already states. Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Retrieves') and resource ('an item from a Azure Cosmos DB container'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'query_container' which might also retrieve items, so it lacks specific sibling distinction.

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 'query_container' or 'update_item'. It mentions retrieving by ID but doesn't explain when ID-based retrieval is preferred over query-based approaches or what happens if the ID doesn't exist.

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

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/robinong79/mcp-cosmos'

If you have feedback or need assistance with the MCP directory API, please join our Discord server