Skip to content

feat(availability): extend tier matrix with per-parameter gating #136

@polaz

Description

@polaz

Problem

Our tier restriction system currently supports two levels of gating:

  1. Per-TOOLToolAvailability.toolRequirements (hide entire tool)
  2. Per-ACTIONToolAvailability.actionRequirements (hide specific actions from discriminated unions)

There is no per-PARAMETER level. When #135 adds weight, healthStatus, isFixed etc. to manage_work_item, these Premium/Ultimate-only parameters will be visible in the schema for Free-tier users. They'll get confusing API errors instead of not seeing unavailable parameters at all.

Target State

Extend the tier matrix to support parameter-level restrictions:

// Current (tool + action levels)
private static actionRequirements: Record<string, ToolActionRequirements> = {
  manage_merge_request: {
    default: { tier: "free", minVersion: 8.0 },
    actions: {
      approve: { tier: "premium", minVersion: 10.6 },
    }
  }
};

// NEW: parameter level
private static parameterRequirements: Record<string, Record<string, ParameterRequirement>> = {
  manage_work_item: {
    weight: { tier: "premium", minVersion: 15.0 },
    isFixed: { tier: "premium", minVersion: 15.0 },
    healthStatus: { tier: "ultimate", minVersion: 15.0 },
    color: { tier: "free", minVersion: 15.0 },
    progressCurrentValue: { tier: "premium", minVersion: 15.0 },
  }
};

Schema Filtering

The schema transformation pipeline (src/utils/schema-utils.ts) should strip restricted parameters from the JSON Schema before exposing it to agents:

  1. Detect instance tier via GitLabVersionDetector (already exists)
  2. For each tool schema, check parameterRequirements
  3. Remove properties entries and required array entries for parameters above the user's tier
  4. This happens at registry init time (same as action filtering)

Implementation

Extend ToolAvailability.ts

interface ParameterRequirement {
  tier: "free" | "premium" | "ultimate";
  minVersion: number;
  notes?: string;
}

// New method
static getRestrictedParameters(toolName: string, tier: GitLabTier): string[] {
  // Returns list of parameter names that should be REMOVED for this tier
}

Extend schema-utils.ts

Add a stripTierRestrictedParameters() function that modifies the JSON Schema object:

  • Removes properties from properties object
  • Removes from required array
  • Handles nested discriminated unions (per-action parameters)

Integration in registry-manager.ts

Apply parameter stripping in buildToolLookupCache() alongside existing action filtering:

// Existing: remove denied actions
const transformedSchema = transformToolSchema(toolName, tool.inputSchema);

// NEW: remove tier-restricted parameters
const finalSchema = stripTierRestrictedParameters(toolName, transformedSchema);

Files to Modify

  • src/services/ToolAvailability.ts — add parameterRequirements map + lookup methods
  • src/utils/schema-utils.ts — add stripTierRestrictedParameters()
  • src/registry-manager.ts — call parameter stripping in build cache

Benefits

  • Clean schema: agents only see parameters they can actually use
  • No confusing API errors for tier-restricted features
  • Consistent with existing tool/action gating pattern
  • WidgetAvailability.ts can be removed (its data moves into the unified ToolAvailability matrix)

Blocked By

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions