forked from zereight/gitlab-mcp
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(availability): extend tier matrix with per-parameter gating #136
Copy link
Copy link
Closed
Labels
Description
Problem
Our tier restriction system currently supports two levels of gating:
- Per-TOOL —
ToolAvailability.toolRequirements(hide entire tool) - Per-ACTION —
ToolAvailability.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:
- Detect instance tier via
GitLabVersionDetector(already exists) - For each tool schema, check
parameterRequirements - Remove
propertiesentries andrequiredarray entries for parameters above the user's tier - 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
propertiesobject - Removes from
requiredarray - 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— addparameterRequirementsmap + lookup methodssrc/utils/schema-utils.ts— addstripTierRestrictedParameters()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.tscan be removed (its data moves into the unifiedToolAvailabilitymatrix)
Blocked By
- feat(workitems): extend manage_work_item with date, time tracking, and tier-specific widgets #135 (parameters must exist to be gated)
Reactions are currently unavailable