GetRecordsByIds
Retrieve multiple database records using their unique identifiers. This tool fetches specific records from RushDB by providing an array of record IDs.
Instructions
Get multiple records by their IDs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recordIds | Yes | Array of record IDs to retrieve |
Implementation Reference
- tools/GetRecordsByIds.ts:19-31 (handler)The core handler function that validates input and retrieves multiple records by their IDs from the database using db.records.findById.export async function GetRecordsByIds(params: { recordIds: string[] }) { const { recordIds } = params if (!Array.isArray(recordIds) || recordIds.length === 0) { return { success: false, message: 'recordIds must be a non-empty array', data: [] } } const result = await db.records.findById(recordIds) return { success: true, count: result.data.length, data: result.data.map((r: any) => r.data) } }
- tools.ts:168-182 (schema)The JSON schema definition for the tool's input parameters, used for tool listing and validation in MCP.{ name: 'GetRecordsByIds', description: 'Get multiple records by their IDs', inputSchema: { type: 'object', properties: { recordIds: { type: 'array', items: { type: 'string' }, description: 'Array of record IDs to retrieve' } }, required: ['recordIds'] } },
- index.ts:443-452 (registration)The switch case in the MCP CallToolRequestHandler that registers and invokes the GetRecordsByIds handler, formatting the response.case 'GetRecordsByIds': const recordsByIds = await GetRecordsByIds({ recordIds: args.recordIds as string[] }) return { content: [ { type: 'text', text: recordsByIds.count > 0 ? JSON.stringify(recordsByIds.data, null, 2) : 'No records found' } ] }