Skip to main content
Glama
dkmaker

mcp-azure-tablestorage

get_table_schema

Retrieve property names and types from a specified table in Azure Table Storage to analyze its structure.

Instructions

Get property names and types from a table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNameYesName of the table to analyze

Implementation Reference

  • The handler function for the get_table_schema tool. It creates a TableClient for the given table, iterates over all entities, collects unique property names and their types (using typeof), builds a schema map, and returns it as JSON text content.
    private async handleGetTableSchema(args: GetSchemaArgs) {
      const tableClient = TableClient.fromConnectionString(
        this.connectionString,
        args.tableName
      );
    
      const propertyMap = new Map<string, Set<string>>();
      const iterator = tableClient.listEntities();
      
      for await (const entity of iterator) {
        Object.entries(entity).forEach(([key, value]) => {
          if (!propertyMap.has(key)) {
            propertyMap.set(key, new Set());
          }
          propertyMap.get(key)?.add(typeof value);
        });
      }
    
      const schema = Object.fromEntries(
        Array.from(propertyMap.entries()).map(([key, types]) => [
          key,
          Array.from(types),
        ])
      );
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(schema, null, 2),
          },
        ],
      };
    }
  • src/index.ts:115-128 (registration)
    Registration of the get_table_schema tool in the ListTools response, including name, description, and JSON inputSchema.
    {
      name: 'get_table_schema',
      description: 'Get property names and types from a table',
      inputSchema: {
        type: 'object',
        properties: {
          tableName: {
            type: 'string',
            description: 'Name of the table to analyze',
          },
        },
        required: ['tableName'],
      },
    },
  • src/index.ts:159-166 (registration)
    Dispatch case in the CallToolRequestHandler that validates the tableName argument and invokes the handleGetTableSchema method.
    case 'get_table_schema':
      const schemaArgs = request.params.arguments as Record<string, unknown>;
      if (typeof schemaArgs?.tableName !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'tableName is required and must be a string');
      }
      return await this.handleGetTableSchema({
        tableName: schemaArgs.tableName
      });
  • TypeScript interface defining the input arguments for the get_table_schema handler.
    interface GetSchemaArgs {
      tableName: string;
    }
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/dkmaker/mcp-azure-tablestorage'

If you have feedback or need assistance with the MCP directory API, please join our Discord server