UNPKG

mcp-quickbase

Version:

Work with Quickbase via Model Context Protocol

198 lines (197 loc) 4.84 kB
import { BaseTool } from "../base"; import { QuickbaseClient } from "../../client/quickbase"; /** * Order by configuration for query */ export interface OrderBy { /** * Field ID to order by */ fieldId: string; /** * Ordering direction: ASC or DESC */ order: "ASC" | "DESC"; } export interface GroupBy { /** * Field ID to group by */ fieldId: number; /** * Grouping strategy */ grouping: "equal-values" | "first-word" | "first-letter" | "1000000" | "100000" | "10000" | "1000" | "100" | "10" | "1" | ".1" | ".01" | ".001"; } /** * Parameters for query_records tool */ export interface QueryRecordsParams { /** * The ID of the table to query */ table_id: string; /** * WHERE clause for filtering records */ where?: string; /** * Fields to select (field IDs) */ select?: string[]; /** * Fields to order by */ orderBy?: OrderBy[]; /** * Fields to group results by for server-side aggregation */ groupBy?: GroupBy[]; /** * Maximum number of records to return */ max_records?: number; /** * Number of records to skip */ skip?: number; /** * Whether to automatically handle pagination for large result sets */ paginate?: boolean; /** * Additional query options */ options?: Record<string, unknown>; } /** * Response from querying records */ export interface QueryRecordsResult { /** * Array of records */ records: Record<string, any>[]; /** * Total number of records matching the query */ totalRecords?: number; /** * Whether this is a partial result set (more records available) */ hasMore?: boolean; /** * Metadata about the query */ metadata?: { /** * Fields included in the result */ fields?: Record<string, unknown>[]; /** * Table ID that was queried */ tableId: string; /** * Number of records returned */ numRecords: number; /** * Number of records skipped */ skip?: number; }; } /** * Tool for querying records from a Quickbase table */ export declare class QueryRecordsTool extends BaseTool<QueryRecordsParams, QueryRecordsResult> { name: string; description: string; /** * Parameter schema for query_records */ paramSchema: { type: string; properties: { table_id: { type: string; description: string; }; where: { type: string; description: string; }; select: { type: string; description: string; items: { type: string; }; }; orderBy: { type: string; description: string; items: { type: string; properties: { fieldId: { type: string; }; order: { type: string; enum: string[]; }; }; }; }; groupBy: { type: string; description: string; items: { type: string; properties: { fieldId: { type: string; description: string; }; grouping: { type: string; description: string; enum: string[]; }; }; required: string[]; }; }; max_records: { type: string; description: string; }; skip: { type: string; description: string; }; paginate: { type: string; description: string; }; options: { type: string; description: string; }; }; required: string[]; }; /** * Constructor * @param client Quickbase client */ constructor(client: QuickbaseClient); /** * Run the query_records tool * @param params Tool parameters * @returns Queried records */ protected run(params: QueryRecordsParams): Promise<QueryRecordsResult>; }