Skip to main content
Glama
andrewlwn77
by andrewlwn77

list_views

Retrieve all views for a specified table in NocoDB to manage data presentation and access configurations.

Instructions

List all views for a table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_idYesThe ID of the table

Implementation Reference

  • The main handler function for the 'list_views' MCP tool. It invokes the NocoDB client's listViews method and formats the response with mapped view details and a count.
    handler: async (client: NocoDBClient, args: { table_id: string }) => {
      const views = await client.listViews(args.table_id);
      return {
        views: views.map((view) => ({
          id: view.id,
          title: view.title,
          type: view.type,
          fk_model_id: view.fk_model_id,
          show_system_fields: view.show_system_fields,
          lock_type: view.lock_type,
          created_at: view.created_at,
          updated_at: view.updated_at,
        })),
        count: views.length,
      };
    },
  • Input schema definition for the list_views tool, specifying the required 'table_id' parameter.
    inputSchema: {
      type: "object",
      properties: {
        table_id: {
          type: "string",
          description: "The ID of the table",
        },
      },
      required: ["table_id"],
    },
  • src/index.ts:55-62 (registration)
    Combines all tool sets including viewTools (containing list_views) into allTools, which is used to register tools with the MCP server for listing and calling.
    const allTools = [
      ...databaseTools,
      ...tableTools,
      ...recordTools,
      ...viewTools,
      ...queryTools,
      ...attachmentTools,
    ];
  • Helper method in NocoDBClient class that performs the API call to retrieve views for a given table ID, used by the list_views handler.
    async listViews(tableId: string): Promise<NocoDBView[]> {
      const response = await this.client.get(
        `/api/v2/meta/tables/${tableId}/views`,
      );
      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