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
| Name | Required | Description | Default |
|---|---|---|---|
| table_id | Yes | The ID of the table |
Implementation Reference
- src/tools/view.ts:18-33 (handler)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, }; },
- src/tools/view.ts:8-17 (schema)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, ];
- src/nocodb-api.ts:302-307 (helper)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 || []; }