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
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | ||
| key | Yes | ||
| name | Yes |
Implementation Reference
- src/index.ts:79-130 (handler)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, }; } }
- src/index.ts:74-78 (schema)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, }; } } );
- src/services/fliptClient.ts:83-94 (helper)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; } }