Skip to main content
Glama

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
NameRequiredDescriptionDefault
base_idYesThe ID of the base/project
table_nameYesThe name of the table
recordsYesArray of records to insert

Implementation Reference

  • 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`, }; },
  • 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"], },
  • 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, ];
  • 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; }

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