UNPKG

mcp-quickbase

Version:

Work with Quickbase via Model Context Protocol

140 lines (139 loc) 3.96 kB
import { BaseTool } from "../base"; import { QuickbaseClient } from "../../client/quickbase"; import { RelationshipFieldInfo } from "./get_relationships"; import { SummaryAccumulationType } from "./create_relationship"; /** * Parameters for update_relationship tool */ export interface UpdateRelationshipParams { /** * The ID of the child table (DBID) containing the relationship */ table_id: string; /** * The ID of the relationship (same as the foreign key field ID) */ relationship_id: number; /** * Optional array of parent field IDs to add as lookup fields in the child table */ lookup_field_ids?: number[]; /** * Optional child field ID to summarize in the parent table */ summary_field_id?: number; /** * Optional label for the summary field created in the parent table */ summary_label?: string; /** * Accumulation type for the summary field (required if summary_field_id is provided) */ summary_accumulation_type?: SummaryAccumulationType; /** * Optional Quickbase query filter for the summary field */ summary_where?: string; } /** * Result from updating a relationship */ export interface UpdateRelationshipResult { /** * The ID of the relationship (same as the foreign key field ID) */ id: number; /** * The ID of the parent table */ parentTableId: string; /** * The ID of the child table */ childTableId: string; /** * The foreign key field in the child table */ foreignKeyField: RelationshipFieldInfo; /** * All lookup fields in the child table (existing + newly added) */ lookupFields: RelationshipFieldInfo[]; /** * All summary fields in the parent table (existing + newly added) */ summaryFields: RelationshipFieldInfo[]; } /** * Tool for updating an existing table-to-table relationship in Quickbase. * * ADDITIVE ONLY - adds lookup fields and/or summary fields to existing relationships. * Does not delete existing fields from the relationship. */ export declare class UpdateRelationshipTool extends BaseTool<UpdateRelationshipParams, UpdateRelationshipResult> { name: string; description: string; /** * Parameter schema for update_relationship with conditional validation */ paramSchema: { type: string; properties: { table_id: { type: string; description: string; }; relationship_id: { type: string; description: string; }; lookup_field_ids: { type: string; items: { type: string; }; description: string; }; summary_field_id: { type: string; description: string; }; summary_label: { type: string; description: string; }; summary_accumulation_type: { type: string; enum: string[]; description: string; }; summary_where: { type: string; description: string; }; }; required: string[]; if: { properties: { summary_field_id: { type: string; }; }; required: string[]; }; then: { required: string[]; }; }; /** * Constructor * @param client Quickbase client */ constructor(client: QuickbaseClient); /** * Run the update_relationship tool * @param params Tool parameters * @returns Updated relationship details */ protected run(params: UpdateRelationshipParams): Promise<UpdateRelationshipResult>; }