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
| Name | Required | Description | Default |
|---|---|---|---|
| readCapacity | Yes | New read capacity units | |
| tableName | Yes | Name of the table | |
| writeCapacity | Yes | New write capacity units |
Implementation Reference
- src/index.ts:439-462 (handler)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}`, }; } }
- src/index.ts:148-160 (schema)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;