Skip to main content
Glama
ZhipingYang

FFS MCP Server

by ZhipingYang

ffs_get_user_info

Retrieve RingCentral AccountId and ExtensionId from user credentials to identify company-wide or individual user contexts for feature flag management.

Instructions

Get AccountId and ExtensionId from RingCentral credentials. Use ExtensionId for individual user, AccountId for entire company.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesRingCentral user email, e.g., user@example.com
passwordYesRingCentral password

Implementation Reference

  • Core handler implementation that executes the tool logic. This function authenticates with RingCentral using username/password credentials, retrieves OAuth token, and fetches account and extension information to return accountId, extensionId, extensionNumber, name, and email.
    export async function getUserInfo(username: string, password: string): Promise<UserInfo> {
      // Step 1: Get OAuth token
      const tokenRes = await httpRequest<RcTokenResponse>(
        `${FFS_CONFIG.rcApiUrl}/restapi/oauth/token`,
        {
          method: 'POST',
          headers: {
            Accept: 'application/json',
            Authorization: `Basic ${FFS_CONFIG.clientCredentials}`,
          },
          body: { grant_type: 'password', username, password },
          isForm: true,
        }
      );
    
      if (tokenRes.data.error) {
        throw new Error(`Authentication failed: ${tokenRes.data.error_description}`);
      }
    
      const token = tokenRes.data.access_token;
    
      // Step 2: Get Account info
      const accountRes = await httpRequest<RcAccountInfo>(
        `${FFS_CONFIG.rcApiUrl}/restapi/v1.0/account/~`,
        {
          method: 'GET',
          headers: { Authorization: `Bearer ${token}` },
        }
      );
    
      // Step 3: Get Extension info
      const extensionRes = await httpRequest<RcExtensionInfo>(
        `${FFS_CONFIG.rcApiUrl}/restapi/v1.0/account/~/extension/~`,
        {
          method: 'GET',
          headers: { Authorization: `Bearer ${token}` },
        }
      );
    
      return {
        accountId: accountRes.data.id,
        extensionId: extensionRes.data.id,
        extensionNumber: extensionRes.data.extensionNumber,
        name: extensionRes.data.name,
        email: extensionRes.data.contact?.email || username,
      };
    }
  • Input schema definition using Zod. Defines two required string parameters: username (RingCentral user email) and password (RingCentral password), both with descriptive metadata.
    {
      username: z.string().describe('RingCentral user email, e.g., user@example.com'),
      password: z.string().describe('RingCentral password'),
    },
  • src/index.ts:27-65 (registration)
    Tool registration using MCP server.tool() method. Registers 'ffs_get_user_info' tool with description, input schema, and async handler function that calls getUserInfo() and formats the response with success/error handling.
    // Tool 1: ffs_get_user_info
    server.tool(
      'ffs_get_user_info',
      'Get AccountId and ExtensionId from RingCentral credentials. Use ExtensionId for individual user, AccountId for entire company.',
      {
        username: z.string().describe('RingCentral user email, e.g., user@example.com'),
        password: z.string().describe('RingCentral password'),
      },
      async ({ username, password }) => {
        try {
          const userInfo = await getUserInfo(username, password);
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify({
                  success: true,
                  ...userInfo,
                  message: `Successfully retrieved user info. Use ExtensionId (${userInfo.extensionId}) for this user only, or AccountId (${userInfo.accountId}) for the entire company.`,
                }, 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,
          };
        }
      }
    );
  • TypeScript interface definition for UserInfo return type. Defines the structure containing accountId, extensionId, extensionNumber, name, and email fields that the tool returns.
    export interface UserInfo {
      accountId: string;
      extensionId: string;
      extensionNumber: string;
      name: string;
      email: string;
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the core behavior (retrieving IDs from credentials) but lacks details on authentication requirements, error handling, rate limits, or response format. It adds some context about credential usage but misses broader behavioral traits.

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 front-loaded and highly concise with two clear sentences: one stating the purpose and another providing usage guidance. Every word earns its place without redundancy or 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?

Given the tool's low complexity (2 parameters, no output schema, no annotations), the description is reasonably complete for its purpose. It explains what the tool does and how to use the outputs, though it could benefit from mentioning response format or error cases to be fully comprehensive.

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 both parameters (username and password) fully. The description doesn't add any parameter-specific details beyond what the schema provides, such as format examples or constraints, meeting the baseline for high schema coverage.

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?

The description clearly states the tool's purpose with specific verbs ('Get AccountId and ExtensionId') and resources ('from RingCentral credentials'), distinguishing it from siblings like ffs_check_account or ffs_update_account by focusing on credential-based ID retrieval rather than account checking or updating.

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

Usage Guidelines5/5

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

It provides explicit usage guidance by specifying when to use the returned IDs: 'Use ExtensionId for individual user, AccountId for entire company.' This helps differentiate from alternatives by clarifying the context for each output, though it doesn't name specific sibling tools for comparison.

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