list_tables
Retrieve and display all tables in an Azure Storage account, optionally filtering results by a provided prefix.
Instructions
List all tables in the storage account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prefix | No | Optional prefix to filter table names |
Implementation Reference
- src/index.ts:271-290 (handler)The core handler function for the 'list_tables' tool. It uses TableServiceClient to iterate over all tables, filters by optional 'prefix' argument, collects table names, and returns them as a JSON-formatted text response.private async handleListTables(args: ListTablesArgs) { const serviceClient = TableServiceClient.fromConnectionString(this.connectionString); const tables = []; const iterator = serviceClient.listTables(); for await (const table of iterator) { if (table.name && (!args.prefix || table.name.startsWith(args.prefix))) { tables.push(table.name); } } return { content: [ { type: 'text', text: JSON.stringify(tables, null, 2), }, ], }; }
- src/index.ts:129-141 (registration)Tool registration in the ListToolsRequest handler, defining name, description, and input schema for 'list_tables'.{ name: 'list_tables', description: 'List all tables in the storage account', inputSchema: { type: 'object', properties: { prefix: { type: 'string', description: 'Optional prefix to filter table names', }, }, }, },
- src/index.ts:167-169 (registration)Dispatch logic in CallToolRequest handler that routes 'list_tables' calls to the handleListTables function.case 'list_tables': const listArgs = request.params.arguments as ListTablesArgs; return await this.handleListTables(listArgs);
- src/index.ts:26-28 (schema)TypeScript interface defining the input parameters for the list_tables tool (optional prefix string). Used for type safety in handler and dispatch.interface ListTablesArgs { prefix?: string; }