list_tables
Retrieve a list of DynamoDB tables in your account, with options for pagination and limiting results, using the DynamoDB MCP Server.
Instructions
Lists all DynamoDB tables in the account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exclusiveStartTableName | No | Name of the table to start from for pagination (optional) | |
| limit | No | Maximum number of tables to return (optional) |
Implementation Reference
- src/index.ts:267-287 (handler)The handler function for the list_tables tool. It creates a ListTablesCommand with optional limit and pagination token, sends it to the DynamoDB client, and returns the table names or error.async function listTables(params: any) { try { const command = new ListTablesCommand({ Limit: params.limit, ExclusiveStartTableName: params.exclusiveStartTableName, }); const response = await dynamoClient.send(command); return { success: true, message: "Tables listed successfully", tables: response.TableNames, lastEvaluatedTable: response.LastEvaluatedTableName, }; } catch (error) { console.error("Error listing tables:", error); return { success: false, message: `Failed to list tables: ${error}`, }; }
- src/index.ts:61-71 (schema)The Tool object definition for list_tables, including name, description, and inputSchema for validation.const LIST_TABLES_TOOL: Tool = { name: "list_tables", description: "Lists all DynamoDB tables in the account", inputSchema: { type: "object", properties: { limit: { type: "number", description: "Maximum number of tables to return (optional)" }, exclusiveStartTableName: { type: "string", description: "Name of the table to start from for pagination (optional)" }, }, }, };
- src/index.ts:598-600 (registration)Registration of the list_tables tool in the ListToolsRequestHandler by including LIST_TABLES_TOOL in the returned tools array.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:611-613 (registration)Dispatch/execution registration in the CallToolRequestHandler switch statement, calling the listTables handler.case "list_tables": result = await listTables(args); break;