Skip to main content
Glama
LawrenceCirillo

QuickBase MCP Server

quickbase_create_advanced_relationship

Define and establish table relationships in QuickBase, automatically creating lookup fields between parent and child tables to streamline data connections and enhance database structure.

Instructions

Create a comprehensive table relationship with automatic lookup fields

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
childTableIdYesChild table ID
lookupFieldsNoLookup fields to create automatically
parentTableIdYesParent table ID
referenceFieldLabelYesLabel for the reference field to create
relationshipTypeNoType of relationshipone-to-many

Implementation Reference

  • The core handler function that implements the advanced relationship creation: creates reference field, establishes relationship, and optionally creates lookup fields.
    async createAdvancedRelationship(
      parentTableId: string, 
      childTableId: string, 
      referenceFieldLabel: string,
      lookupFields?: Array<{ parentFieldId: number; childFieldLabel: string }>,
      relationshipType: 'one-to-many' | 'many-to-many' = 'one-to-many'
    ): Promise<{ referenceFieldId: number; lookupFieldIds: number[] }> {
      try {
        // Step 1: Create the reference field in the child table
        const referenceFieldId = await this.createField(childTableId, {
          label: referenceFieldLabel,
          fieldType: 'reference',
          required: false,
          unique: false,
          properties: {
            lookupTableId: parentTableId
          }
        });
    
        // Step 2: Create the relationship
        await this.createRelationship(parentTableId, childTableId, referenceFieldId);
    
        // Step 3: Create lookup fields if specified
        const lookupFieldIds: number[] = [];
        if (lookupFields && lookupFields.length > 0) {
          for (const lookup of lookupFields) {
            const lookupFieldId = await this.createLookupField(
              childTableId,
              parentTableId,
              referenceFieldId,
              lookup.parentFieldId,
              lookup.childFieldLabel
            );
            lookupFieldIds.push(lookupFieldId);
          }
        }
    
        return { referenceFieldId, lookupFieldIds };
      } catch (error) {
        console.error('Error creating advanced relationship:', error);
        throw error;
      }
    }
  • Tool registration in the quickbaseTools array, including name, description, and inputSchema.
    {
      name: 'quickbase_create_advanced_relationship',
      description: 'Create a comprehensive table relationship with automatic lookup fields',
      inputSchema: {
        type: 'object',
        properties: {
          parentTableId: { type: 'string', description: 'Parent table ID' },
          childTableId: { type: 'string', description: 'Child table ID' },
          referenceFieldLabel: { type: 'string', description: 'Label for the reference field to create' },
          lookupFields: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                parentFieldId: { type: 'number', description: 'Field ID in parent table to lookup' },
                childFieldLabel: { type: 'string', description: 'Label for lookup field in child table' }
              },
              required: ['parentFieldId', 'childFieldLabel']
            },
            description: 'Lookup fields to create automatically'
          },
          relationshipType: { 
            type: 'string', 
            enum: ['one-to-many', 'many-to-many'], 
            default: 'one-to-many',
            description: 'Type of relationship' 
          }
        },
        required: ['parentTableId', 'childTableId', 'referenceFieldLabel']
      }
    },
  • Zod schema definition for input validation of the tool.
    const CreateAdvancedRelationshipSchema = z.object({
      parentTableId: z.string().describe('Parent table ID'),
      childTableId: z.string().describe('Child table ID'),
      referenceFieldLabel: z.string().describe('Label for the reference field to create'),
      lookupFields: z.array(z.object({
        parentFieldId: z.number().describe('Field ID in parent table to lookup'),
        childFieldLabel: z.string().describe('Label for lookup field in child table')
      })).optional().describe('Lookup fields to create automatically'),
      relationshipType: z.enum(['one-to-many', 'many-to-many']).default('one-to-many').describe('Type of relationship')
    });
  • Helper method used by createAdvancedRelationship to create individual lookup fields.
    async createLookupField(
      childTableId: string,
      parentTableId: string,
      referenceFieldId: number,
      parentFieldId: number,
      lookupFieldLabel: string
    ): Promise<number> {
      const response = await this.axios.post('/fields', {
        tableId: childTableId,
        label: lookupFieldLabel,
        fieldType: 'lookup',
        properties: {
          lookupReference: {
            tableId: parentTableId,
            fieldId: parentFieldId,
            referenceFieldId: referenceFieldId
          }
        }
      });
      return response.data.id;
    }
  • Helper method called by createAdvancedRelationship to establish the basic relationship.
    async createRelationship(parentTableId: string, childTableId: string, foreignKeyFieldId: number): Promise<void> {
      await this.axios.post('/relationships', {
        parentTableId,
        childTableId,
        foreignKeyFieldId
      });
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'create' which implies a write/mutation operation, but doesn't address permissions needed, whether the operation is reversible, potential side effects on existing data, or error conditions. The term 'comprehensive' is vague and doesn't clarify what makes this relationship creation 'advanced'.

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

Conciseness5/5

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

The description is a single, efficient sentence that gets straight to the point with no wasted words. It's appropriately sized for the tool's complexity and front-loads the key information about creating relationships with automatic lookup fields.

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 mutation tool with 5 parameters and no annotations or output schema, the description is insufficient. It doesn't explain what 'comprehensive' means, doesn't clarify the relationship between this tool and similar siblings, and provides no information about return values, error handling, or the practical implications of creating 'automatic lookup fields'.

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 already documents all 5 parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'automatic lookup fields' which relates to the 'lookupFields' parameter, but doesn't provide additional context about how these fields function or their implications.

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 action ('Create') and resource ('comprehensive table relationship with automatic lookup fields'), which distinguishes it from simpler relationship creation tools. However, it doesn't explicitly differentiate from sibling tools like 'quickbase_create_relationship' or 'quickbase_create_lookup_field', which appear to handle similar functionality.

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 'quickbase_create_relationship' or 'quickbase_create_lookup_field'. It mentions 'automatic lookup fields' but doesn't explain when this advanced functionality is preferred over simpler approaches.

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/LawrenceCirillo/QuickBase-MCP-Server'

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