airtable-mcp-server
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -45,5 +45,25 @@ import nodeFetch from 'node-fetch'; | ||
async listRecords(baseId, tableId, options) { | ||
const queryParams = options?.maxRecords ? `?maxRecords=${options.maxRecords}` : ''; | ||
const response = await this.fetchFromAPI(`/v0/${baseId}/${tableId}${queryParams}`, z.object({ records: z.array(z.object({ id: z.string(), fields: z.record(z.any()) })) })); | ||
return response.records; | ||
const maxRecords = options?.maxRecords; | ||
let allRecords = []; | ||
let offset; | ||
do { | ||
const queryParams = new URLSearchParams(); | ||
if (maxRecords) | ||
queryParams.append('maxRecords', maxRecords.toString()); | ||
if (offset) | ||
queryParams.append('offset', offset); | ||
// eslint-disable-next-line no-await-in-loop | ||
const response = await this.fetchFromAPI(`/v0/${baseId}/${tableId}?${queryParams.toString()}`, z.object({ | ||
records: z.array(z.object({ id: z.string(), fields: z.record(z.any()) })), | ||
offset: z.string().optional(), | ||
})); | ||
allRecords = allRecords.concat(response.records); | ||
offset = response.offset; | ||
// Stop if we've reached maxRecords | ||
if (maxRecords && allRecords.length >= maxRecords) { | ||
allRecords = allRecords.slice(0, maxRecords); | ||
break; | ||
} | ||
} while (offset); | ||
return allRecords; | ||
} | ||
@@ -50,0 +70,0 @@ async getRecord(baseId, tableId, recordId) { |
@@ -396,3 +396,3 @@ import { z } from 'zod'; | ||
tableId: z.string(), | ||
maxRecords: z.number().optional(), | ||
maxRecords: z.number().optional().describe('Maximum number of records to return. Defaults to 100.'), | ||
}); | ||
@@ -399,0 +399,0 @@ export const ListTablesArgsSchema = z.object({ |
{ | ||
"name": "airtable-mcp-server", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Airtable Model Context Protocol Server, for allowing AI systems to interact with your Airtable bases", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -5,3 +5,3 @@ # airtable-mcp-server | ||
https://github.com/user-attachments/assets/b4b42c1e-857b-4226-b4ff-edafda9de141 | ||
https://github.com/user-attachments/assets/c8285e76-d0ed-4018-94c7-20535db6c944 | ||
@@ -15,3 +15,3 @@ ## Usage | ||
"mcpServers": { | ||
"postgres": { | ||
"airtable": { | ||
"command": "npx", | ||
@@ -18,0 +18,0 @@ "args": [ |
272231
6855