install_openfeature_sdk
Fetch installation prompts and setup instructions for OpenFeature SDKs across multiple programming languages and frameworks to implement feature flag management.
Instructions
Fetch and return OpenFeature install prompt Markdown by guide name. Available guides: android, dotnet, go, ios, java, javascript, nestjs, nodejs, php, python, react, ruby. Input: { guide: string }
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guide | Yes |
Implementation Reference
- src/tools/installTools.ts:121-145 (handler)The handler function that executes the tool: parses input for technology and providers, fetches bundled prompt, builds provider-specific instructions, processes the prompt text, logs it, and returns text content with optional resource links.async (args: unknown): Promise<CallToolResult> => { const { technology, providers } = InstallTechnologyArgsSchema.parse(args); const prompt: string = BUNDLED_PROMPTS[technology]; const providerPrompts = buildProviderPrompts(providers, technology); const finalText = processPromptWithProviders( prompt, providers, technology, providerPrompts ); console.error(`install_openfeature_sdk prompt text: \n${finalText}`); return { content: [ { type: "text" as const, text: finalText, }, // Include resource links for any available provider docs so clients can read them directly ...buildProviderResourceLinks(providers, technology), ], }; } );
- src/tools/installTools.ts:16-19 (schema)Zod input schema for the tool arguments: requires 'technology' (enum of SDK types) and optional array of 'providers'.const InstallTechnologyArgsSchema = z.object({ technology: InstallTechnologySchema, providers: providersSchema.optional().default([]), });
- src/tools/installTools.ts:103-146 (registration)Exports registerInstallTools function which registers the 'install_openfeature_sdk' tool including name, description, annotations, input schema, and handler.export function registerInstallTools( registerToolWithErrorHandling: RegisterToolWithErrorHandling ): void { registerToolWithErrorHandling( "install_openfeature_sdk", { description: [ "Fetch OpenFeature SDK installation instructions, and follow the instructions to install the OpenFeature SDK.", "If you are installing a provider, also fetches the provider installation instructions.", "Also includes documentation and examples for using OpenFeature SDK in your application.", "Choose the technology that matches the application's language/framework.", ].join(" "), annotations: { title: "Install OpenFeature SDK", readOnlyHint: true, }, inputSchema: InstallTechnologyArgsSchema.shape, }, async (args: unknown): Promise<CallToolResult> => { const { technology, providers } = InstallTechnologyArgsSchema.parse(args); const prompt: string = BUNDLED_PROMPTS[technology]; const providerPrompts = buildProviderPrompts(providers, technology); const finalText = processPromptWithProviders( prompt, providers, technology, providerPrompts ); console.error(`install_openfeature_sdk prompt text: \n${finalText}`); return { content: [ { type: "text" as const, text: finalText, }, // Include resource links for any available provider docs so clients can read them directly ...buildProviderResourceLinks(providers, technology), ], }; } ); }
- src/server.ts:72-72 (registration)Top-level call to registerInstallTools in the server setup, which triggers registration of the install_openfeature_sdk tool.registerInstallTools(registerToolWithErrorHandling);
- src/tools/installTools.ts:65-101 (helper)Helper function to process the base prompt with provider-specific instructions, handling marker replacement or appending.function processPromptWithProviders( prompt: string, providers: ProviderName[], technology: z.infer<typeof InstallTechnologySchema>, providerPrompts: string[] ): string { // Marker-based injection: replace the block between markers when providers are specified const providersMarkerPattern = /<!--\s*PROVIDERS:START\s*-->[\s\S]*?<!--\s*PROVIDERS:END\s*-->/; const providerBlock = providerPrompts.length ? ["### Step 2: Provider installation", "", ...providerPrompts].join("\n") : ""; const providersAppendix = providerPrompts.length ? `\n\n---\n\nProvider installation instructions for ${technology}:\n\n${providerPrompts.join( "\n" )}` : ""; let finalText = prompt; if (providers.length > 0) { if (providersMarkerPattern.test(prompt)) { // Replace the marker block with provider content (without the markers) finalText = prompt.replace(providersMarkerPattern, providerBlock); } else { // Fallback: append to the end if no marker exists in the prompt finalText = `${prompt}${providersAppendix}`; } } else { // No providers specified: strip the marker block entirely finalText = prompt.replace(providersMarkerPattern, ""); } return finalText; }