bulk_insert
Insert multiple records into a NocoDB table at once to efficiently manage database entries and perform bulk data operations.
Instructions
Insert multiple records into a table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base_id | Yes | The ID of the base/project | |
| table_name | Yes | The name of the table | |
| records | Yes | Array of records to insert |
Implementation Reference
- src/tools/record.ts:71-87 (handler)The handler function that executes the bulk_insert tool logic by calling the NocoDB client's bulkInsert method.handler: async ( client: NocoDBClient, args: { base_id: string; table_name: string; records: any[]; }, ) => { const records = await client.bulkInsert(args.base_id, args.table_name, { records: args.records, }); return { records, count: records.length, message: `${records.length} records inserted successfully`, }; },
- src/tools/record.ts:49-70 (schema)Input schema defining the parameters for the bulk_insert tool.inputSchema: { type: "object", properties: { base_id: { type: "string", description: "The ID of the base/project", }, table_name: { type: "string", description: "The name of the table", }, records: { type: "array", description: "Array of records to insert", items: { type: "object", additionalProperties: true, }, }, }, required: ["base_id", "table_name", "records"], },
- src/tools/record.ts:46-88 (registration)The bulk_insert tool definition and registration within the recordTools array.{ name: "bulk_insert", description: "Insert multiple records into a table", inputSchema: { type: "object", properties: { base_id: { type: "string", description: "The ID of the base/project", }, table_name: { type: "string", description: "The name of the table", }, records: { type: "array", description: "Array of records to insert", items: { type: "object", additionalProperties: true, }, }, }, required: ["base_id", "table_name", "records"], }, handler: async ( client: NocoDBClient, args: { base_id: string; table_name: string; records: any[]; }, ) => { const records = await client.bulkInsert(args.base_id, args.table_name, { records: args.records, }); return { records, count: records.length, message: `${records.length} records inserted successfully`, }; }, },
- src/index.ts:55-62 (registration)Top-level registration where recordTools (including bulk_insert) is combined into allTools for MCP server.const allTools = [ ...databaseTools, ...tableTools, ...recordTools, ...viewTools, ...queryTools, ...attachmentTools, ];
- src/nocodb-api.ts:163-182 (helper)Supporting bulkInsert method in NocoDBClient used by the tool handler.async bulkInsert( baseId: string, tableName: string, options: BulkInsertOptions, ): Promise<NocoDBRecord[]> { // First get table ID from table name const tables = await this.listTables(baseId); const table = tables.find( (t) => t.table_name === tableName || t.title === tableName, ); if (!table) { throw new NocoDBError(`Table ${tableName} not found`); } const response = await this.client.post( `/api/v2/tables/${table.id}/records`, options.records, ); return response.data; }