create_view
Create a new view for a NocoDB table to display data in different formats like grid, gallery, form, kanban, or calendar.
Instructions
Create a new view for a table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table_id | Yes | The ID of the table | |
| title | Yes | Title of the new view | |
| type | No | Type of view (1=Grid, 2=Gallery, 3=Form, 4=Kanban, 5=Calendar) |
Implementation Reference
- src/tools/view.ts:58-82 (handler)Executes the create_view tool by calling the NocoDBClient's createView method and formatting the response.handler: async ( client: NocoDBClient, args: { table_id: string; title: string; type?: number; }, ) => { const view = await client.createView( args.table_id, args.title, args.type || 1, ); return { view: { id: view.id, title: view.title, type: view.type, fk_model_id: view.fk_model_id, created_at: view.created_at, updated_at: view.updated_at, }, message: `View '${view.title}' created successfully`, }; },
- src/tools/view.ts:38-57 (schema)Defines the input schema for the create_view tool, including required table_id and title, optional type.inputSchema: { type: "object", properties: { table_id: { type: "string", description: "The ID of the table", }, title: { type: "string", description: "Title of the new view", }, type: { type: "number", description: "Type of view (1=Grid, 2=Gallery, 3=Form, 4=Kanban, 5=Calendar)", default: 1, }, }, required: ["table_id", "title"], },
- src/index.ts:55-62 (registration)Includes the viewTools (containing create_view) in the allTools array registered with the MCP server.const allTools = [ ...databaseTools, ...tableTools, ...recordTools, ...viewTools, ...queryTools, ...attachmentTools, ];
- src/nocodb-api.ts:309-322 (helper)NocoDBClient method invoked by the tool handler to perform the HTTP POST request creating the view.async createView( tableId: string, title: string, type: number = 1, ): Promise<NocoDBView> { const response = await this.client.post( `/api/v2/meta/tables/${tableId}/views`, { title, type, }, ); return response.data; }