Skip to main content
Glama
ZhipingYang

FFS MCP Server

by ZhipingYang

ffs_update_account

Update feature flag values for RingCentral accounts or extensions to control specific functionality settings.

Instructions

Update an AccountId or ExtensionId to use a specific Flag value. Uses MCP Auto Condition for management.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flagIdYesComplete FFS Flag ID
idYesAccountId or ExtensionId to update
targetValueIdYesTarget Value ID from ffs_get_flag_options

Implementation Reference

  • The main handler function for 'ffs_update_account' tool. It receives flagId, id, and targetValueId parameters, calls updateAccountValue helper, parses JSON values, and returns formatted success/error response.
    async ({ flagId, id, targetValueId }) => {
      try {
        const result = await updateAccountValue(flagId, id, targetValueId);
    
        let currentParsed: unknown = result.currentValue;
        let previousParsed: unknown = result.previousValue;
        try {
          currentParsed = JSON.parse(result.currentValue);
          if (result.previousValue) {
            previousParsed = JSON.parse(result.previousValue);
          }
        } catch {
          // Keep as string
        }
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify({
                success: true,
                flagId,
                id,
                previousValue: previousParsed,
                currentValue: currentParsed,
                targetValueId,
                message: result.previousValue
                  ? `Successfully updated ID ${id} from ${JSON.stringify(previousParsed)} to ${JSON.stringify(currentParsed)}`
                  : `Successfully set ID ${id} to ${JSON.stringify(currentParsed)}`,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify({
                success: false,
                message: error instanceof Error ? error.message : 'Unknown error',
              }, null, 2),
            },
          ],
          isError: true,
        };
      }
    }
  • Core helper function updateAccountValue that implements the account update logic: retrieves flag config, finds target rule, tracks previous value, removes ID from existing conditions, adds to MCP Auto condition, reassigns priorities, and sends PUT request to update the flag.
    export async function updateAccountValue(
      flagId: string,
      id: string,
      targetValueId: string
    ): Promise<{ success: boolean; previousValue: string | null; currentValue: string }> {
      // Step 1: Get current flag configuration
      const flag = await getFlag(flagId);
      const newFlag = JSON.parse(JSON.stringify(flag)) as FfsFlag;
      delete (newFlag as { creationTime?: string }).creationTime;
    
      // Step 2: Find target rule
      const targetRule = newFlag.rules.find((r) => r.value.id === targetValueId);
      if (!targetRule) {
        throw new Error(`Value ID not found: ${targetValueId}`);
      }
    
      // Step 3: Get previous value
      let previousValue: string | null = null;
      for (const rule of newFlag.rules) {
        for (const cond of rule.conditions) {
          if (cond.dimension === 'AccountId' && cond.argument?.split(',').includes(id)) {
            previousValue = rule.value.value;
          }
        }
      }
    
      // Step 4: Remove ID from all conditions
      for (const rule of newFlag.rules) {
        for (const cond of rule.conditions) {
          if (cond.dimension === 'AccountId' && cond.argument) {
            const accounts = cond.argument.split(',');
            if (accounts.includes(id)) {
              cond.argument = accounts.filter((a) => a !== id).join(',');
            }
          }
        }
      }
    
      // Step 5: Add to target MCP Auto condition
      const mcpConditionName = `${FFS_CONFIG.mcpAutoPrefix} [${targetValueId}]`;
      let mcpCondition = targetRule.conditions.find((c) =>
        c.description?.startsWith(FFS_CONFIG.mcpAutoPrefix)
      );
    
      if (mcpCondition) {
        const accounts = mcpCondition.argument ? mcpCondition.argument.split(',') : [];
        if (!accounts.includes(id)) {
          accounts.push(id);
          mcpCondition.argument = accounts.join(',');
        }
        mcpCondition.description = mcpConditionName;
      } else {
        mcpCondition = {
          description: mcpConditionName,
          priority: 1,
          dimension: 'AccountId',
          operator: 'IsOneOf',
          argumentDataType: 'ListString',
          argument: id,
        };
        targetRule.conditions.push(mcpCondition);
      }
    
      // Step 6: Reassign priorities
      interface ConditionWithValueId {
        cond: { priority?: number; operator: string; description?: string };
        valueId: string;
      }
      const allConditions: ConditionWithValueId[] = [];
      for (const rule of newFlag.rules) {
        for (const cond of rule.conditions) {
          if (cond.priority !== undefined && cond.operator !== 'DefaultValue') {
            allConditions.push({ cond, valueId: rule.value.id });
          }
        }
      }
    
      const mcpConditions = allConditions.filter((c) =>
        c.cond.description?.startsWith(FFS_CONFIG.mcpAutoPrefix)
      );
      const otherConditions = allConditions.filter(
        (c) => !c.cond.description?.startsWith(FFS_CONFIG.mcpAutoPrefix)
      );
    
      let priority = 1;
      for (const { cond, valueId } of mcpConditions) {
        cond.priority = priority++;
        cond.description = `${FFS_CONFIG.mcpAutoPrefix} [${valueId}]`;
      }
      for (const { cond } of otherConditions) {
        cond.priority = priority++;
      }
    
      // Step 7: Send PUT request
      const putRes = await httpRequest<FfsFlag>(
        `${FFS_CONFIG.baseUrl}${FFS_ENDPOINTS.flags}/${flagId}/`,
        {
          method: 'PUT',
          body: newFlag,
        }
      );
    
      if (putRes.status !== 200) {
        throw new Error(`Failed to update flag: ${JSON.stringify(putRes.data)}`);
      }
    
      return {
        success: true,
        previousValue,
        currentValue: targetRule.value.value,
      };
    }
  • src/index.ts:245-252 (registration)
    Tool registration using server.tool() with name 'ffs_update_account', description, and Zod schema defining flagId, id, and targetValueId as required string parameters.
    server.tool(
      'ffs_update_account',
      'Update an AccountId or ExtensionId to use a specific Flag value. Uses MCP Auto Condition for management.',
      {
        flagId: z.string().describe('Complete FFS Flag ID'),
        id: z.string().describe('AccountId or ExtensionId to update'),
        targetValueId: z.string().describe('Target Value ID from ffs_get_flag_options'),
      },
  • FfsFlag interface definition that represents the flag structure manipulated by updateAccountValue, including id, rules with conditions, and other flag properties.
    export interface FfsFlag {
      id: string;
      description?: string;
      dataType: string;
      status: string;
      defaultValue: string;
      rules: FfsRule[];
      creationTime?: string;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates an update operation, implying mutation, but doesn't specify permissions required, whether changes are reversible, error handling, or rate limits. The mention of 'MCP Auto Condition for management' adds some context but is vague, failing to fully compensate for the lack of annotations.

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

Conciseness4/5

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

The description is concise with two sentences that efficiently convey the tool's purpose and mechanism. It avoids unnecessary details and is front-loaded with the core action. However, the second sentence about 'MCP Auto Condition' could be more specific to enhance clarity without adding length.

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?

Given the complexity of an update operation with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., side effects, permissions), response format, or error conditions. While the schema covers parameters well, the overall context for safe and effective use is incomplete.

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 three parameters (flagId, id, targetValueId) with clear descriptions. The description adds minimal value by implying the parameters are used for updating a flag value, but it doesn't provide additional syntax, format details, or usage examples beyond what the schema offers, meeting the baseline for high coverage.

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 ('Update') and the target ('an AccountId or ExtensionId'), specifying what gets updated ('to use a specific Flag value'). It distinguishes from siblings like ffs_check_account (which likely checks rather than updates) and ffs_get_flag_options (which likely retrieves options). However, it doesn't explicitly differentiate from ffs_search_flag or ffs_get_user_info, keeping it from a perfect score.

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 mentions 'Uses MCP Auto Condition for management,' which provides some context about the mechanism, but it doesn't offer explicit guidance on when to use this tool versus alternatives like ffs_check_account or ffs_search_flag. No prerequisites, exclusions, or clear scenarios are stated, leaving usage ambiguous.

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/ZhipingYang/ffs-mcp-server'

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