Skip to main content
Glama
imankamyabi

DynamoDB MCP Server

by imankamyabi

get_item

Retrieve specific items from DynamoDB tables using their primary key with this tool. Designed for secure and precise data access without delete functionality to prevent data loss.

Instructions

Retrieves an item from a table by its primary key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesPrimary key of the item to retrieve
tableNameYesName of the table

Implementation Reference

  • The main handler function for the 'get_item' tool. It constructs a GetItemCommand with the provided tableName and key, sends it to the DynamoDB client, unmarshalls the response item if present, and returns a success/error object.
    async function getItem(params: any) {
      try {
        const command = new GetItemCommand({
          TableName: params.tableName,
          Key: marshall(params.key),
        });
        
        const response = await dynamoClient.send(command);
        return {
          success: true,
          message: `Item retrieved successfully from table ${params.tableName}`,
          item: response.Item ? unmarshall(response.Item) : null,
        };
      } catch (error) {
        console.error("Error getting item:", error);
        return {
          success: false,
          message: `Failed to get item: ${error}`,
        };
      }
  • The Tool object definition for 'get_item', including name, description, and inputSchema for validation (requires tableName and key).
    const GET_ITEM_TOOL: Tool = {
      name: "get_item",
      description: "Retrieves an item from a table by its primary key",
      inputSchema: {
        type: "object",
        properties: {
          tableName: { type: "string", description: "Name of the table" },
          key: { type: "object", description: "Primary key of the item to retrieve" },
        },
        required: ["tableName", "key"],
      },
    };
  • src/index.ts:598-600 (registration)
    Registration of the 'get_item' tool (as GET_ITEM_TOOL) in the ListToolsRequestHandler, where the server lists all available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [CREATE_TABLE_TOOL, UPDATE_CAPACITY_TOOL, PUT_ITEM_TOOL, GET_ITEM_TOOL, QUERY_TABLE_TOOL, SCAN_TABLE_TOOL, DESCRIBE_TABLE_TOOL, LIST_TABLES_TOOL, CREATE_GSI_TOOL, UPDATE_GSI_TOOL, CREATE_LSI_TOOL, UPDATE_ITEM_TOOL],
    }));
  • src/index.ts:632-634 (registration)
    Dispatch/registration in the CallToolRequestHandler switch statement, routing calls to 'get_item' to the getItem handler function.
    case "get_item":
      result = await getItem(args);
      break;
  • Import of the AWS SDK GetItemCommand class used in the handler.
    GetItemCommand,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves an item, implying a read-only operation, but doesn't specify whether it returns null for missing keys, requires specific permissions, has rate limits, or details the return format (e.g., JSON object). For a read tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 front-loads the core action ('retrieves an item') and includes essential details ('from a table by its primary key'). There is no wasted text, making it highly concise and well-structured for quick understanding.

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?

Given the complexity of database operations, no annotations, and no output schema, the description is incomplete. It doesn't explain what happens if the key doesn't exist, the return format, error conditions, or how it differs from sibling tools like 'query_table'. For a tool with 2 parameters and rich sibling context, more detail is needed to fully guide an agent.

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%, with clear descriptions for both parameters ('key' as primary key and 'tableName' as table name). The description adds minimal value beyond the schema by mentioning 'by its primary key,' which reinforces the schema's 'key' parameter but doesn't provide additional syntax or format details. Baseline 3 is appropriate when the 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 tool's purpose with a specific verb ('retrieves') and resource ('item from a table'), specifying it uses the primary key. It distinguishes from siblings like 'put_item' (create) or 'update_item' (modify) by focusing on retrieval, though it doesn't explicitly contrast with 'query_table' or 'scan_table' for alternative lookup methods.

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_table' or 'scan_table', which also retrieve items but with different methods (e.g., by query conditions or full scans). It lacks context on prerequisites, such as needing an existing table, or exclusions, like not supporting secondary indexes.

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/imankamyabi/dynamodb-mcp-server'

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