Skip to main content
Glama
jjikky

DynamoDB Read-Only MCP

by jjikky

scan-table

Scan items from a DynamoDB table by specifying filters, limits, or projections. Use this tool to retrieve and analyze data efficiently in a read-only environment.

Instructions

Scan items from a DynamoDB table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionAttributeValuesNoFilter expression attribute values (JSON format)
filterExpressionNoFilter expression (e.g: 'age > :minAge')
limitNoMaximum number of items to return (default: 20)
projectionExpressionNoProjection expression (e.g: "id")
tableNameYesName of the table to scan

Implementation Reference

  • src/index.ts:78-126 (registration)
    Registers the MCP tool 'scan-table' with input schema, description, and a handler function that calls the scanTable helper.
    server.tool(
      'scan-table',
      'Scan items from a DynamoDB table',
      {
        tableName: z.string().describe('Name of the table to scan'),
        limit: z.number().optional().describe('Maximum number of items to return (default: 20)'),
        filterExpression: z.string().optional().describe("Filter expression (e.g: 'age > :minAge')"),
        expressionAttributeValues: z
          .record(z.any())
          .optional()
          .describe('Filter expression attribute values (JSON format)'),
        projectionExpression: z.string().optional().describe('Projection expression (e.g: "id")'),
      },
      async ({
        tableName,
        limit,
        filterExpression,
        expressionAttributeValues,
        projectionExpression,
      }) => {
        try {
          const items = await scanTable(
            tableName,
            limit,
            filterExpression,
            expressionAttributeValues,
            projectionExpression
          );
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(items, null, 2),
              },
            ],
          };
        } catch (error: any) {
          return {
            isError: true,
            content: [
              {
                type: 'text',
                text: `Error occurred: ${error.message}`,
              },
            ],
          };
        }
      }
    );
  • Zod schema defining input parameters for the scan-table tool.
    {
      tableName: z.string().describe('Name of the table to scan'),
      limit: z.number().optional().describe('Maximum number of items to return (default: 20)'),
      filterExpression: z.string().optional().describe("Filter expression (e.g: 'age > :minAge')"),
      expressionAttributeValues: z
        .record(z.any())
        .optional()
        .describe('Filter expression attribute values (JSON format)'),
      projectionExpression: z.string().optional().describe('Projection expression (e.g: "id")'),
    },
  • Handler function for the scan-table tool that performs the scan via helper and returns formatted response.
    async ({
      tableName,
      limit,
      filterExpression,
      expressionAttributeValues,
      projectionExpression,
    }) => {
      try {
        const items = await scanTable(
          tableName,
          limit,
          filterExpression,
          expressionAttributeValues,
          projectionExpression
        );
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(items, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: `Error occurred: ${error.message}`,
            },
          ],
        };
      }
    }
  • Core helper function implementing DynamoDB ScanCommand with parameters for the scan-table tool.
    export async function scanTable(
      tableName: string,
      limit: number = 100,
      filterExpression?: string,
      expressionAttributeValues?: Record<string, any>,
      projectionExpression?: string
    ) {
      console.error('# Starting scanTable function:', {
        tableName,
        limit,
        filterExpression,
        expressionAttributeValues,
        projectionExpression,
      });
    
      try {
        const params: any = {
          TableName: tableName,
          Limit: limit,
        };
    
        if (filterExpression) {
          params.FilterExpression = filterExpression;
        }
    
        if (expressionAttributeValues) {
          params.ExpressionAttributeValues = expressionAttributeValues;
        }
    
        if (projectionExpression) {
          params.ProjectionExpression = projectionExpression;
        }
    
        console.error('# Scan parameters:', params);
        const command = new ScanCommand(params);
        console.error('# Scan command created successfully');
    
        const response = await dynamodb.send(command);
        console.error('# Scan response received:', response);
        return response?.Items || [];
      } catch (error) {
        console.error('# Error in scanTable function:', error);
        throw error;
      }
    }
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. 'Scan' implies a read operation, but it doesn't specify whether this is paginated, has performance implications for large tables, requires specific permissions, or what the output format looks like. For a DynamoDB operation with potential complexity, this leaves significant gaps in understanding tool 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 extremely concise - a single sentence that directly states the tool's purpose without any unnecessary words. It's perfectly front-loaded and every word earns its place, making it efficient for an agent to parse.

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 DynamoDB scanning tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'scanning' means in DynamoDB context (sequential reads vs. query efficiency), doesn't mention performance considerations for large tables, and provides no information about return format or pagination behavior.

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 all parameters are documented in the schema itself. The description doesn't add any meaningful parameter semantics beyond what's already in the schema - it doesn't explain relationships between parameters like how 'filterExpression' works with 'expressionAttributeValues' or typical scanning patterns. 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 action ('scan') and resource ('items from a DynamoDB table'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'query-table' or 'paginate-query-table' which might also retrieve data from DynamoDB tables, missing an opportunity for 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-table' or 'get-item'. It doesn't mention typical use cases for scanning (e.g., full table reads vs. indexed queries) or any prerequisites, leaving the agent to infer usage from context alone.

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/jjikky/dynamo-readonly-mcp'

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