Skip to main content
Glama

BulkCreateRecords

Create multiple database records simultaneously in RushDB to streamline data insertion and improve efficiency for batch operations.

Instructions

Create multiple records in a single operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelYesLabel for all records
dataYesArray of record data to insert
transactionIdNoOptional transaction ID for atomic bulk creation

Implementation Reference

  • The main handler function implementing the BulkCreateRecords tool logic: creates multiple records using db.records.createMany within an optional transaction and returns success message with generated IDs.
    export async function BulkCreateRecords({ label, data, transactionId }: BulkCreateRecordsArgs): Promise<BulkCreateRecordsResult> { const result = await db.records.createMany({ label, data }, transactionId) const ids = result.data.map((record: any) => record.id()) return { message: `Successfully created ${ids.length} records with label '${label}'`, ids } }
  • TypeScript type definitions for input arguments (BulkCreateRecordsArgs) and output result (BulkCreateRecordsResult) used by the handler.
    type BulkCreateRecordsArgs = { label: string data: Record<string, any>[] transactionId?: string } type BulkCreateRecordsResult = { message: string ids: string[] }
  • tools.ts:257-269 (registration)
    Tool registration entry in the tools array, providing the name, description, and JSON schema for input validation in the MCP server.
    { name: 'BulkCreateRecords', description: 'Create multiple records in a single operation', inputSchema: { type: 'object', properties: { label: { type: 'string', description: 'Label for all records' }, data: { type: 'array', items: { type: 'object' }, description: 'Array of record data to insert' }, transactionId: { type: 'string', description: 'Optional transaction ID for atomic bulk creation' } }, required: ['label', 'data'] } },
  • Dispatcher switch case that invokes the BulkCreateRecords handler with parsed arguments and formats the MCP response content.
    case 'BulkCreateRecords': const bulkCreateResult = await BulkCreateRecords({ label: args.label as string, data: args.data as Record<string, any>[], transactionId: args.transactionId as string | undefined }) return { content: [ { type: 'text', text: `${bulkCreateResult.message}\nIDs: ${bulkCreateResult.ids.join(', ')}` } ] }
  • tools.ts:28-28 (registration)
    Includes 'BulkCreateRecords' in the ToolName type union for type safety.
    | 'BulkCreateRecords'

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/1pxone/RushDB'

If you have feedback or need assistance with the MCP directory API, please join our Discord server