Skip to main content
Glama
hackle-io

hackle-mcp

Official
by hackle-io

remote-config-update

Modify and update remote configurations to manage conditional values and default settings based on specific targeting rules for efficient A/B testing and feature flag management.

Instructions

Updates remote config's content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYes
remoteConfigIdYesRemote config's id.

Implementation Reference

  • The handler function that performs the HTTP PUT request to the /api/v1/remote-configs/{remoteConfigId}/parameters endpoint using WebClient to update the remote config content.
    async ({ remoteConfigId, body }) => {
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(await WebClient.put(`/api/v1/remote-configs/${remoteConfigId}/parameters`, body)),
          },
        ],
      };
    },
  • Zod schema defining the input parameters for the tool: remoteConfigId (number) and body object with dataType, remoteConfigDefaultValue, and conditionalValues array for targeting rules.
    {
      remoteConfigId: z.number().positive().describe("Remote config's id."),
      body: z.object({
        dataType: z
          .enum(['STRING', 'JSON', 'NUMBER', 'BOOLEAN'])
          .describe(
            "Type of Remote Config's value. You must provide remote config's value type to match with this field.",
          ),
        remoteConfigDefaultValue: z.union([z.string(), z.number(), z.boolean()]),
        conditionalValues: z
          .array(
            z.object({
              ruleName: z.string(),
              remoteConfigValue: z.union([z.string(), z.number(), z.boolean()]),
              target: z
                .object({
                  conditions: z
                    .array(
                      z.object({
                        key: z.object({
                          type: z
                            .enum(['HACKLE_PROPERTY', 'USER_PROPERTY', 'SEGMENT', 'AB_TEST', 'FEATURE_FLAG', 'COHORT'])
                            .describe("Condition's type."),
                          name: z
                            .string()
                            .describe(
                              "Property's name if type is HACKLE_PROPERTY or USER_PROPERTY. Experiment key if type is AB_TEST. Feature flag key if type is FEATURE_FLAG. You can put any non-empty string if type is COHORT or SEGMENT.",
                            ),
                        }),
                        match: z.object({
                          operator: z.enum([
                            'IS_ONE_OF',
                            'IS_NOT_ONE_OF',
                            'IS_STARTS_WITH',
                            'IS_NOT_STARTS_WITH',
                            'IS_ENDS_WITH',
                            'IS_NOT_ENDS_WITH',
                            'IS_CONTAINS',
                            'IS_NOT_CONTAINS',
                            'EQ',
                            'NOT_EQ',
                            'GT',
                            'GTE',
                            'LT',
                            'LTE',
                            'IS_TRUE',
                            'IS_FALSE',
                            'VERSION_EQ',
                            'VERSION_NOT_EQ',
                            'VERSION_GT',
                            'VERSION_GTE',
                            'VERSION_LT',
                            'VERSION_LTE',
                          ]),
                          valueType: z.enum(['NUMBER', 'STRING', 'BOOLEAN', 'VERSION']),
                          values: z
                            .array(z.union([z.string(), z.number(), z.boolean()]))
                            .describe(
                              "Values of targeting condition's key. Followings are some special cases: The values will be treated as names if you are using SEGMENT. Only strings 'A' and 'B' are allowed if type is AB_TEST. Only boolean values are accepted if type is FEATURE_FLAG. You should put cohort's id if type is COHORT.",
                            ),
                        }),
                      }),
                    )
                    .describe(
                      "Users who The user he satisfies all conditions in this array will see this rule's remote config value.",
                    ),
                })
                .describe('Targeting rule.'),
            }),
          )
          .describe('The earlier a condition is placed in the array, the earlier it is applied.'),
      }),
    },
  • src/index.ts:399-485 (registration)
    Registers the 'remote-config-update' tool on the MCP server using server.tool(), providing name, description, input schema, and inline handler function.
    server.tool(
      'remote-config-update',
      "Updates remote config's content.",
      {
        remoteConfigId: z.number().positive().describe("Remote config's id."),
        body: z.object({
          dataType: z
            .enum(['STRING', 'JSON', 'NUMBER', 'BOOLEAN'])
            .describe(
              "Type of Remote Config's value. You must provide remote config's value type to match with this field.",
            ),
          remoteConfigDefaultValue: z.union([z.string(), z.number(), z.boolean()]),
          conditionalValues: z
            .array(
              z.object({
                ruleName: z.string(),
                remoteConfigValue: z.union([z.string(), z.number(), z.boolean()]),
                target: z
                  .object({
                    conditions: z
                      .array(
                        z.object({
                          key: z.object({
                            type: z
                              .enum(['HACKLE_PROPERTY', 'USER_PROPERTY', 'SEGMENT', 'AB_TEST', 'FEATURE_FLAG', 'COHORT'])
                              .describe("Condition's type."),
                            name: z
                              .string()
                              .describe(
                                "Property's name if type is HACKLE_PROPERTY or USER_PROPERTY. Experiment key if type is AB_TEST. Feature flag key if type is FEATURE_FLAG. You can put any non-empty string if type is COHORT or SEGMENT.",
                              ),
                          }),
                          match: z.object({
                            operator: z.enum([
                              'IS_ONE_OF',
                              'IS_NOT_ONE_OF',
                              'IS_STARTS_WITH',
                              'IS_NOT_STARTS_WITH',
                              'IS_ENDS_WITH',
                              'IS_NOT_ENDS_WITH',
                              'IS_CONTAINS',
                              'IS_NOT_CONTAINS',
                              'EQ',
                              'NOT_EQ',
                              'GT',
                              'GTE',
                              'LT',
                              'LTE',
                              'IS_TRUE',
                              'IS_FALSE',
                              'VERSION_EQ',
                              'VERSION_NOT_EQ',
                              'VERSION_GT',
                              'VERSION_GTE',
                              'VERSION_LT',
                              'VERSION_LTE',
                            ]),
                            valueType: z.enum(['NUMBER', 'STRING', 'BOOLEAN', 'VERSION']),
                            values: z
                              .array(z.union([z.string(), z.number(), z.boolean()]))
                              .describe(
                                "Values of targeting condition's key. Followings are some special cases: The values will be treated as names if you are using SEGMENT. Only strings 'A' and 'B' are allowed if type is AB_TEST. Only boolean values are accepted if type is FEATURE_FLAG. You should put cohort's id if type is COHORT.",
                              ),
                          }),
                        }),
                      )
                      .describe(
                        "Users who The user he satisfies all conditions in this array will see this rule's remote config value.",
                      ),
                  })
                  .describe('Targeting rule.'),
              }),
            )
            .describe('The earlier a condition is placed in the array, the earlier it is applied.'),
        }),
      },
      async ({ remoteConfigId, body }) => {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(await WebClient.put(`/api/v1/remote-configs/${remoteConfigId}/parameters`, body)),
            },
          ],
        };
      },
    );

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/hackle-io/hackle-mcp'

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