Skip to main content
Glama
imankamyabi

DynamoDB MCP Server

by imankamyabi

update_capacity

Modify the read and write capacity units of a DynamoDB table to manage performance and scalability using the DynamoDB MCP Server.

Instructions

Updates the provisioned capacity of a table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
readCapacityYesNew read capacity units
tableNameYesName of the table
writeCapacityYesNew write capacity units

Implementation Reference

  • The main handler function for the 'update_capacity' tool. It uses UpdateTableCommand to update the provisioned throughput (read/write capacity) of a DynamoDB table.
    async function updateCapacity(params: any) {
      try {
        const command = new UpdateTableCommand({
          TableName: params.tableName,
          ProvisionedThroughput: {
            ReadCapacityUnits: params.readCapacity,
            WriteCapacityUnits: params.writeCapacity,
          },
        });
        
        const response = await dynamoClient.send(command);
        return {
          success: true,
          message: `Capacity updated successfully for table ${params.tableName}`,
          details: response.TableDescription,
        };
      } catch (error) {
        console.error("Error updating capacity:", error);
        return {
          success: false,
          message: `Failed to update capacity: ${error}`,
        };
      }
    }
  • The Tool object definition for 'update_capacity', including name, description, and inputSchema for validation.
    const UPDATE_CAPACITY_TOOL: Tool = {
      name: "update_capacity",
      description: "Updates the provisioned capacity of a table",
      inputSchema: {
        type: "object",
        properties: {
          tableName: { type: "string", description: "Name of the table" },
          readCapacity: { type: "number", description: "New read capacity units" },
          writeCapacity: { type: "number", description: "New write capacity units" },
        },
        required: ["tableName", "readCapacity", "writeCapacity"],
      },
    };
  • src/index.ts:598-600 (registration)
    Registers the UPDATE_CAPACITY_TOOL in the list returned by ListToolsRequestHandler.
    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:626-628 (registration)
    Dispatches tool calls to the updateCapacity handler in the CallToolRequestHandler switch statement.
    case "update_capacity":
      result = await updateCapacity(args);
      break;
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