Skip to main content
Glama
imankamyabi

DynamoDB MCP Server

by imankamyabi

create_table

Design and configure new DynamoDB tables by specifying table name, partition key, sort key, and provisioned read/write capacity units through the DynamoDB MCP Server.

Instructions

Creates a new DynamoDB table with specified configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
partitionKeyYesName of the partition key
partitionKeyTypeYesType of partition key (S=String, N=Number, B=Binary)
readCapacityYesProvisioned read capacity units
sortKeyNoName of the sort key (optional)
sortKeyTypeNoType of sort key (optional)
tableNameYesName of the table to create
writeCapacityYesProvisioned write capacity units

Implementation Reference

  • Executes the create_table tool by constructing a DynamoDB CreateTableCommand based on input parameters (table name, keys, capacity) and sending it to the client, returning success/error response.
    async function createTable(params: any) {
      try {
        const command = new CreateTableCommand({
          TableName: params.tableName,
          AttributeDefinitions: [
            { AttributeName: params.partitionKey, AttributeType: params.partitionKeyType },
            ...(params.sortKey ? [{ AttributeName: params.sortKey, AttributeType: params.sortKeyType }] : []),
          ],
          KeySchema: [
            { AttributeName: params.partitionKey, KeyType: "HASH" as const },
            ...(params.sortKey ? [{ AttributeName: params.sortKey, KeyType: "RANGE" as const }] : []),
          ],
          ProvisionedThroughput: {
            ReadCapacityUnits: params.readCapacity,
            WriteCapacityUnits: params.writeCapacity,
          },
        });
        
        const response = await dynamoClient.send(command);
        return {
          success: true,
          message: `Table ${params.tableName} created successfully`,
          details: response.TableDescription,
        };
      } catch (error) {
        console.error("Error creating table:", error);
        return {
          success: false,
          message: `Failed to create table: ${error}`,
        };
      }
    }
  • Input schema definition for the create_table tool, validating parameters such as tableName, partitionKey, capacities, and optional sortKey.
    inputSchema: {
      type: "object",
      properties: {
        tableName: { type: "string", description: "Name of the table to create" },
        partitionKey: { type: "string", description: "Name of the partition key" },
        partitionKeyType: { type: "string", enum: ["S", "N", "B"], description: "Type of partition key (S=String, N=Number, B=Binary)" },
        sortKey: { type: "string", description: "Name of the sort key (optional)" },
        sortKeyType: { type: "string", enum: ["S", "N", "B"], description: "Type of sort key (optional)" },
        readCapacity: { type: "number", description: "Provisioned read capacity units" },
        writeCapacity: { type: "number", description: "Provisioned write capacity units" },
      },
      required: ["tableName", "partitionKey", "partitionKeyType", "readCapacity", "writeCapacity"],
    },
  • src/index.ts:598-600 (registration)
    Registers the create_table tool (as CREATE_TABLE_TOOL) among the list of available tools served in response to ListToolsRequestSchema.
    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:608-610 (registration)
    Registers the handler dispatch for create_table tool calls within the CallToolRequestSchema switch statement.
    case "create_table":
      result = await createTable(args);
      break;

Tool Definition Quality

Score is being calculated. Check back soon.

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