Skip to main content
Glama
apitable

AITable MCP Server

Official

list_records

Retrieve and manage records from specified AITable datasheets with pagination, field filtering, sorting, and formula-based filtering. Enables precise data extraction and organization for enhanced analysis.

Instructions

Read the records from a specified datasheet with support for pagination, field filtering, and sorting options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoThe returned record results are limited to the specified fields by name. Multiple fields should be separated by commas without spaces (e.g. 'field1,field2,field3').
filterByFormulaNoFilter the records by a formula. The formula should be in the format accepted by AITable, this is useful for filtering records based on specific criteria. e.g. '{field1}="value1"' or 'AND({field1}="value1", {field2}="value2")'.
node_idYesThe ID of the datasheet to fetch records from.
pageNumNoSpecifies the page number of the page, which is used in conjunction with the pageSize parameter.
pageSizeNoHow many records are returned per page.
sortNoSort the returned records.
viewIdNoWhen the viewId is explicitly specified, all records in the specified view will be returned in turn according to the sorting in the specified view.

Implementation Reference

  • The handler function that implements the core logic for the 'list_records' tool. It validates the node_id, builds the query string for pagination, sorting, etc., fetches records from the AITable API, and returns formatted success or error responses.
    async ({ node_id, sort, pageNum, pageSize, fields, viewId }) => {
      try {
        if (!node_id) {
          throw new Error("datasheet ID is required.");
        }
    
        const queryStr = aitableService.buildQueryString({
          sort, pageNum, pageSize, fields, viewId,
          cellFormat: "string",
          fieldKey: "name",
        });
        const endpoint = `/v1/datasheets/${node_id}/records${queryStr}`;
    
        const result: ResponseVO<GetRecordsResponeDataVO> = await aitableService.fetchFromAPI(endpoint, {
          method: "GET",
        });
    
        if (!result.success) {
          throw new Error(result.message || "Failed to list records");
        }
    
        return formatToolResponse({
          success: true,
          data: result.data
        });
      }
      catch (error) {
        console.error("Error in get_records:", error);
        return formatToolResponse({
          success: false,
          message: error instanceof Error ? error.message : "Unknown error occurred"
        }, true);
      }
    }
  • Zod schema defining the input parameters for the list_records tool, including required datasheet ID, optional sorting, pagination, field filtering, view ID, and formula-based filtering.
    {
      node_id: z.string().describe('The ID of the datasheet to fetch records from.'),
      sort: z.array(z.object({
        field: z.string().describe("field name"),
        order: z.enum(["asc", "desc"]).describe("Sorting order, must be 'asc' or 'desc'"),
      })).optional().describe("Sort the returned records."),
      pageNum: z.number().default(1).optional().describe("Specifies the page number of the page, which is used in conjunction with the pageSize parameter."),
      pageSize: z.number().min(1).max(1000).default(20).optional().describe("How many records are returned per page."),
      fields: z.string().optional().describe("The returned record results are limited to the specified fields by name. Multiple fields should be separated by commas without spaces (e.g. 'field1,field2,field3')."),
      viewId: z.string().optional().describe("When the viewId is explicitly specified, all records in the specified view will be returned in turn according to the sorting in the specified view."),
      filterByFormula: z.string().optional().describe("Filter the records by a formula. The formula should be in the format accepted by AITable, this is useful for filtering records based on specific criteria. e.g. '{field1}=\"value1\"' or 'AND({field1}=\"value1\", {field2}=\"value2\")'."),
    },
  • src/index.ts:132-180 (registration)
    The server.tool call that registers the 'list_records' tool with the MCP server, including its name, description, input schema, and handler function.
    server.tool("list_records",
      "Read the records from a specified datasheet with support for pagination, field filtering, and sorting options.",
      {
        node_id: z.string().describe('The ID of the datasheet to fetch records from.'),
        sort: z.array(z.object({
          field: z.string().describe("field name"),
          order: z.enum(["asc", "desc"]).describe("Sorting order, must be 'asc' or 'desc'"),
        })).optional().describe("Sort the returned records."),
        pageNum: z.number().default(1).optional().describe("Specifies the page number of the page, which is used in conjunction with the pageSize parameter."),
        pageSize: z.number().min(1).max(1000).default(20).optional().describe("How many records are returned per page."),
        fields: z.string().optional().describe("The returned record results are limited to the specified fields by name. Multiple fields should be separated by commas without spaces (e.g. 'field1,field2,field3')."),
        viewId: z.string().optional().describe("When the viewId is explicitly specified, all records in the specified view will be returned in turn according to the sorting in the specified view."),
        filterByFormula: z.string().optional().describe("Filter the records by a formula. The formula should be in the format accepted by AITable, this is useful for filtering records based on specific criteria. e.g. '{field1}=\"value1\"' or 'AND({field1}=\"value1\", {field2}=\"value2\")'."),
      },
      async ({ node_id, sort, pageNum, pageSize, fields, viewId }) => {
        try {
          if (!node_id) {
            throw new Error("datasheet ID is required.");
          }
    
          const queryStr = aitableService.buildQueryString({
            sort, pageNum, pageSize, fields, viewId,
            cellFormat: "string",
            fieldKey: "name",
          });
          const endpoint = `/v1/datasheets/${node_id}/records${queryStr}`;
    
          const result: ResponseVO<GetRecordsResponeDataVO> = await aitableService.fetchFromAPI(endpoint, {
            method: "GET",
          });
    
          if (!result.success) {
            throw new Error(result.message || "Failed to list records");
          }
    
          return formatToolResponse({
            success: true,
            data: result.data
          });
        }
        catch (error) {
          console.error("Error in get_records:", error);
          return formatToolResponse({
            success: false,
            message: error instanceof Error ? error.message : "Unknown error occurred"
          }, true);
        }
      }
    );
  • TypeScript type definition for the response data structure returned by the list_records tool, including pagination info and array of records.
    export type GetRecordsResponeDataVO = {
      total: number,
      pageSize: number,
      pageNum: number,
      records: RecordVO[],
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it's a read operation. It doesn't disclose authentication requirements, rate limits, error conditions, pagination behavior beyond mentioning support, or what happens with invalid inputs. For a 7-parameter tool with complex filtering/sorting capabilities, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It wastes no words but could be slightly more structured by separating core function from capabilities. Every element earns its place, though it's somewhat dense for quick scanning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex read tool with 7 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain return format, error handling, authentication needs, or practical usage patterns. The agent must rely entirely on the input schema and trial-and-error to understand this tool's full behavior and limitations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 7 parameters. The description adds minimal value beyond confirming pagination, filtering, and sorting capabilities - which are already evident from parameter names. It doesn't provide additional context about parameter interactions or usage patterns beyond what's in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Read the records from a specified datasheet' with specific capabilities (pagination, field filtering, sorting). It distinguishes from siblings like 'create_record' (write vs read) and 'get_fields_schema' (metadata vs data), but doesn't explicitly differentiate from 'search_nodes' which might overlap in data retrieval functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search_nodes' or 'create_record'. It mentions capabilities but doesn't specify scenarios, prerequisites, or exclusions. The agent must infer usage from the tool name and parameter set alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/apitable/aitable-mcp-server'

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