Skip to main content
Glama

update_view_group_levels

Idempotent

Set grouping on an Airtable view: replace existing group levels or append new ones below them. Pass an empty array to clear all grouping.

Instructions

Set grouping on a view. Default mode replaces all existing group levels — pass an empty array with operation="replace" to clear grouping. Use operation="append" to add new group levels below the existing ones without rewriting them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesThe Airtable base/application ID
viewIdYesThe view ID (e.g. "viwXXX")
groupLevelsYesArray of group levels. Empty array [] clears grouping when operation="replace".
operationNoHow the given groupLevels interact with existing ones. "replace" (default) overwrites; "append" adds the provided levels after the existing group stack.
debugNoWhen true, include raw Airtable response in output for diagnostics

Implementation Reference

  • The main tool handler for 'update_view_group_levels'. Validates inputs (appId, viewId, groupLevels, operation), handles the 'append' operation by reading current group levels from the view via getView(), merges them, then calls client.updateGroupLevels(). Returns a summary with viewId, operation, and groupCount.
    async update_view_group_levels({ appId, viewId, groupLevels, operation, debug }) {
      let effectiveLevels = groupLevels;
      if (operation === 'append') {
        const current = await client.getView(appId, viewId);
        const existing = Array.isArray(current.groupLevels) ? current.groupLevels : [];
        effectiveLevels = [...existing, ...(Array.isArray(groupLevels) ? groupLevels : [])];
      }
      const result = await client.updateGroupLevels(appId, viewId, effectiveLevels);
      return ok(
        { updated: true, viewId, operation: operation || 'replace', groupCount: effectiveLevels.length },
        result,
        debug,
      );
    },
  • The client-level method updateGroupLevels() that sends the actual HTTP request to Airtable's internal API endpoint /v0.3/view/{viewId}/updateGroupLevels. Generates group-level IDs (glv-prefixed), sets order (default 'ascending'), forces emptyGroupState to 'hidden' (the API rejects 'visible').
    async updateGroupLevels(appId, viewId, groupLevels) {
      assertAirtableId(appId, 'appId');
      assertAirtableId(viewId, 'viewId');
      const url = `https://airtable.com/v0.3/view/${viewId}/updateGroupLevels`;
      const levels = groupLevels.map(g => ({
        id: g.id || ('glv' + this._genRandomId()),
        columnId: g.columnId,
        order: g.order || 'ascending',
        emptyGroupState: 'hidden', // API only accepts "hidden"; "visible" causes INVALID_REQUEST
      }));
      const payload = { groupLevels: levels };
    
      const res = await this.auth.postForm(url, this._mutationParams(payload, appId), appId);
    
      if (!res.ok) {
        const errBody = await res.text().catch(() => '');
        throw new Error(`updateGroupLevels failed (${res.status}): ${errBody}`);
      }
    
      return res.json();
    }
  • The MCP tool input schema definition for 'update_view_group_levels' — defines the expected properties (appId, viewId, groupLevels array, operation enum, debug). Annotated as non-destructive, idempotent. Describes the replace/append modes and notes that the Airtable API only accepts emptyGroupState='hidden'.
    {
      name: 'update_view_group_levels',
      description: 'Set grouping on a view. Default mode replaces all existing group levels — pass an empty array with operation="replace" to clear grouping. Use operation="append" to add new group levels below the existing ones without rewriting them.',
      annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
      inputSchema: {
        type: 'object',
        properties: {
          appId: { type: 'string', description: 'The Airtable base/application ID' },
          viewId: { type: 'string', description: 'The view ID (e.g. "viwXXX")' },
          groupLevels: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                columnId: { type: 'string', description: 'Field ID to group by' },
                order: { type: 'string', description: '"ascending" or "descending". Default: "ascending"' },
                emptyGroupState: { type: 'string', description: '"hidden" only — the Airtable API rejects "visible" with INVALID_REQUEST. Omit this field or pass "hidden". Default: "hidden".' },
              },
              required: ['columnId'],
            },
            description: 'Array of group levels. Empty array [] clears grouping when operation="replace".',
          },
          operation: {
            type: 'string',
            enum: ['replace', 'append'],
            description: 'How the given groupLevels interact with existing ones. "replace" (default) overwrites; "append" adds the provided levels after the existing group stack.',
          },
          debug: debugProp,
        },
        required: ['appId', 'viewId', 'groupLevels'],
      },
    },
  • Registration of 'update_view_group_levels' in the TOOL_CATEGORIES map, categorized as 'view-write' (non-destructive view mutation).
    update_view_group_levels: 'view-write',
  • Mirror registration of 'update_view_group_levels' in the extension's TOOL_CATEGORIES map (must stay in sync with tool-config.js), also categorized as 'view-write'.
    update_view_group_levels:  'view-write',
Behavior3/5

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

Annotations already indicate idempotent, non-destructive. Description adds behavior for replace vs append and clearing. No contradictions, but could detail error handling.

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?

Two efficient sentences, front-loaded with core action, no fluff.

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

Completeness4/5

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

Sufficient for a view update tool with 5 params and no output schema. Could mention error handling for invalid column IDs, but overall complete.

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

Parameters4/5

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

Schema covers params fully; description adds context on operation defaults and interaction with groupLevels. Adds value beyond schema.

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

Purpose5/5

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

Clearly states the tool sets grouping on a view, with two operations (replace/append). Distinguishes from sibling tools like apply_view_sorts.

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

Usage Guidelines4/5

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

Explains when to use each operation and how to clear grouping. Lacks explicit when-not-to-use scenarios but provides adequate guidance.

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

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/Automations-Project/VSCode-Airtable-Formula'

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