Skip to main content
Glama
cuongtl1992

Unleash MCP (Feature Toggle)

setStrategySortOrder

Define the execution sequence of strategies for a feature flag in a specified environment, ensuring precise control over feature activation logic.

Instructions

Set the sort order of strategies for a feature flag in a specific environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentYes
featureNameYes
projectIdYes
strategyIdsYes

Implementation Reference

  • The main handler function for the setStrategySortOrder tool, which calls the underlying setStrategySortOrder function and formats the response.
    export async function handleSetStrategySortOrder(params: {
      projectId: string;
      featureName: string;
      environment: string;
      strategyIds: string[];
    }) {
      try {
        // Set the strategy sort order
        const result = await setStrategySortOrder(
          params.projectId,
          params.featureName,
          params.environment,
          params.strategyIds
        );
        
        if (!result) {
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({ 
                success: false,
                error: `Failed to set strategy sort order for feature flag '${params.featureName}'` 
              }, null, 2)
            }],
            isError: true
          };
        }
        
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: true,
              message: `Successfully set strategy sort order for feature flag '${params.featureName}' in environment '${params.environment}'`
            }, null, 2)
          }]
        };
      } catch (error: any) {
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              success: false,
              error: error.message 
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • Zod schema defining the input parameters for the setStrategySortOrder tool.
    export const SetStrategySortOrderParamsSchema = {
      projectId: z.string().min(1),
      featureName: z.string().min(1).max(100).regex(/^[a-z0-9-_.]+$/, {
        message: "Name must be URL-friendly: use only lowercase, numbers, hyphens, underscores, and periods"
      }),
      environment: z.string().min(1),
      strategyIds: z.array(z.string()).min(1)
    };
  • src/server.ts:136-141 (registration)
    Registration of the setStrategySortOrderTool in the MCP server using server.tool().
    server.tool(
      setStrategySortOrderTool.name,
      setStrategySortOrderTool.description,
      setStrategySortOrderTool.paramsSchema as any,
      setStrategySortOrderTool.handler as any
    );
  • Core helper function that makes the HTTP POST request to Unleash API to set the strategy sort order.
    export async function setStrategySortOrder(
      projectId: string,
      featureName: string,
      environment: string,
      strategyIds: string[]
    ): Promise<boolean> {
      try {
        const endpoint = `/api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/strategies/set-sort-order`;
        await client.post(endpoint, strategyIds);
        logger.info(`Successfully set strategy sort order for feature ${featureName} in environment ${environment}`);
        return true;
      } catch (error) {
        logger.error(`Error setting strategy sort order for feature ${featureName}:`, error);
        return false;
      }
    } 
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 this is a mutation operation ('Set'), but doesn't mention permissions required, whether changes are reversible, rate limits, error conditions, or what the response looks like. For a tool that modifies strategy ordering with 4 required parameters, this leaves significant behavioral gaps.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. Every word contributes to understanding the tool's function, making it appropriately concise for its complexity level.

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?

For a mutation tool with 4 required parameters, 0% schema description coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain what 'setting sort order' entails operationally, what format 'strategyIds' should be in, or what happens to existing strategies not in the list. The context signals indicate high complexity that the description doesn't address.

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

Parameters2/5

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

Schema description coverage is 0%, so all 4 parameters are undocumented in the schema. The description only mentions 'feature flag', 'environment', and 'strategies' generally, without explaining what 'strategyIds' represents, the format of 'projectId', or constraints on 'featureName'. It adds minimal semantic value beyond what's implied by parameter names.

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 ('Set the sort order') and target resource ('strategies for a feature flag in a specific environment'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from sibling tools like 'updateStrategy' or 'patchFlag', which might also modify strategy-related aspects.

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 provides no guidance on when to use this tool versus alternatives like 'updateStrategy' or 'patchFlag'. It mentions the context ('for a feature flag in a specific environment') but doesn't specify prerequisites, exclusions, or comparative use cases with sibling tools.

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

Related 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/cuongtl1992/unleash-mcp'

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