Skip to main content
Glama
flipt-io

Flipt MCP Server

Official
by flipt-io

update_namespace

Modify the key, name, or description of a namespace in Flipt MCP Server to manage and update feature flag configurations efficiently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNo
keyYes
nameYes

Implementation Reference

  • Executes the update_namespace tool: fetches current namespace, merges provided name and description, calls fliptClient.updateNamespace, and returns formatted response or error.
    async args => {
      try {
        const currentNamespace = await fliptClient.getNamespace(args.key);
        if (!currentNamespace) {
          return {
            content: [
              {
                type: 'text',
                text: `Namespace ${args.key} not found`,
              },
            ],
            isError: true,
          };
        }
    
        // update changed fields
        const updatedNamespace = {
          ...currentNamespace,
          name: args.name || currentNamespace.name,
          description: args.description || currentNamespace.description,
        };
    
        const namespace = await fliptClient.updateNamespace(
          currentNamespace.key!,
          updatedNamespace.name!,
          updatedNamespace.description
        );
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(namespace, null, 2),
            },
          ],
          _meta: {
            uri: `flipt://namespaces/${args.key}`,
          },
        };
      } catch (error: any) {
        console.error('Error updating namespace:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Failed to update namespace: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining input parameters for the update_namespace tool: key (required string), name (required string), description (optional string).
    {
      key: z.string().min(1),
      name: z.string().min(1),
      description: z.string().optional(),
    },
  • src/index.ts:72-131 (registration)
    Registers the update_namespace tool with MCP server using server.tool, including schema and handler.
    server.tool(
      'update_namespace',
      {
        key: z.string().min(1),
        name: z.string().min(1),
        description: z.string().optional(),
      },
      async args => {
        try {
          const currentNamespace = await fliptClient.getNamespace(args.key);
          if (!currentNamespace) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Namespace ${args.key} not found`,
                },
              ],
              isError: true,
            };
          }
    
          // update changed fields
          const updatedNamespace = {
            ...currentNamespace,
            name: args.name || currentNamespace.name,
            description: args.description || currentNamespace.description,
          };
    
          const namespace = await fliptClient.updateNamespace(
            currentNamespace.key!,
            updatedNamespace.name!,
            updatedNamespace.description
          );
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(namespace, null, 2),
              },
            ],
            _meta: {
              uri: `flipt://namespaces/${args.key}`,
            },
          };
        } catch (error: any) {
          console.error('Error updating namespace:', error);
          return {
            content: [
              {
                type: 'text',
                text: `Failed to update namespace: ${error.message}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper method in FliptClient that calls the generated NamespacesServiceApi.updateNamespace to perform the actual API update.
    async updateNamespace(key: string, name: string, description?: string) {
      try {
        const response = await this.namespacesApi.updateNamespace(key, {
          name,
          description,
        });
        return response;
      } catch (error) {
        console.error('Error updating namespace:', error);
        throw error;
      }
    }

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

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