Skip to main content
Glama
andrewlwn77
by andrewlwn77

list_tables

Retrieve all tables within a specified NocoDB base to view database structure and available data collections.

Instructions

List all tables in a base

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_idYesThe ID of the base/project

Implementation Reference

  • The handler function for the 'list_tables' MCP tool. It calls the NocoDB client's listTables method with the provided base_id and returns a formatted response containing the list of tables with selected metadata fields and the total count.
    handler: async (client: NocoDBClient, args: { base_id: string }) => {
      const tables = await client.listTables(args.base_id);
      return {
        tables: tables.map((table) => ({
          id: table.id,
          table_name: table.table_name,
          title: table.title,
          type: table.type,
          enabled: table.enabled,
          created_at: table.created_at,
          updated_at: table.updated_at,
        })),
        count: tables.length,
      };
    },
  • The input schema definition for the 'list_tables' tool, specifying an object with a required 'base_id' string parameter.
    inputSchema: {
      type: "object",
      properties: {
        base_id: {
          type: "string",
          description: "The ID of the base/project",
        },
      },
      required: ["base_id"],
    },
  • src/index.ts:55-62 (registration)
    Combines and registers 'tableTools' (which includes 'list_tables') with other tool sets into 'allTools', which is used by the MCP server to handle ListToolsRequestSchema and CallToolRequestSchema.
    const allTools = [
      ...databaseTools,
      ...tableTools,
      ...recordTools,
      ...viewTools,
      ...queryTools,
      ...attachmentTools,
    ];
  • Helper method in NocoDBClient that performs the actual API call to retrieve the list of tables for a given base ID via the NocoDB meta endpoint.
    async listTables(baseId: string): Promise<NocoDBTable[]> {
      const response = await this.client.get(
        `/api/v1/db/meta/projects/${baseId}/tables`,
      );
      return response.data.list;
    }

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/andrewlwn77/nocodb-mcp'

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