describe-table
Retrieve comprehensive details about a DynamoDB table, including schema and configuration, by specifying its name using this tool on the DynamoDB Read-Only MCP server.
Instructions
Get detailed information about a DynamoDB table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tableName | Yes | Name of the table to get details for |
Implementation Reference
- src/index.ts:47-76 (registration)MCP server.tool registration for 'describe-table', defining name, description, input schema, and thin async handler that calls describeTable and formats response.server.tool( 'describe-table', 'Get detailed information about a DynamoDB table', { tableName: z.string().describe('Name of the table to get details for'), }, async ({ tableName }) => { try { const tableInfo = await describeTable(tableName); return { content: [ { type: 'text', text: JSON.stringify(tableInfo, null, 2), }, ], }; } catch (error: any) { return { isError: true, content: [ { type: 'text', text: `Error occurred: ${error.message}`, }, ], }; } } );
- src/dynamo-helpers.ts:21-35 (handler)Core handler logic: creates DescribeTableCommand with tableName and sends it to DynamoDB client, returning the Table description or throwing error.export async function describeTable(tableName: string) { console.error('# Starting describeTable function:', tableName); try { const command = new DescribeTableCommand({ TableName: tableName, }); console.error('# DescribeTable command created successfully'); const response = await dynamodb.send(command); console.error('# DescribeTable response received:', response); return response.Table; } catch (error) { console.error('# Error in describeTable function:', error); throw error; } }
- src/index.ts:50-52 (schema)Zod input schema defining 'tableName' as required string parameter.{ tableName: z.string().describe('Name of the table to get details for'), },
- src/dynamo-client.ts:19-32 (helper)Helper function to initialize and provide the DynamoDBDocumentClient instance used by describeTable.export const getDynamodb = (): DynamoDBDocumentClient => { if (!dynamoDbDocClient) { dynamoDbClient = new DynamoDBClient({ region: process.env.AWS_REGION || 'ap-northeast-2', credentials: { accessKeyId: process.env.AWS_ACCESS_KEY_ID || '', secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || '', sessionToken: process.env.AWS_SESSION_TOKEN || undefined, // Optional, only if using temporary credentials }, }); dynamoDbDocClient = DynamoDBDocumentClient.from(dynamoDbClient); } return dynamoDbDocClient; };