ffs_search_flag
Search for Feature Flag Service (FFS) flags using keywords or flag IDs to find matching flags with their identifiers and types.
Instructions
Search for FFS flags by keyword. Returns matching flags with their IDs and types.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes | Search keyword or complete Flag ID |
Implementation Reference
- src/ffs-service.ts:66-73 (handler)Core handler logic for ffs_search_flag - the searchFlags function that makes HTTP request to FFS API to search for flags by keyword
export async function searchFlags(keyword: string): Promise<FfsFlagSearchResult[]> { const res = await httpRequest<{ flags: FfsFlagSearchResult[] }>( `${FFS_CONFIG.baseUrl}${FFS_ENDPOINTS.flags}/?flagId=${encodeURIComponent(keyword)}`, { method: 'GET' } ); return res.data.flags || []; } - src/index.ts:67-114 (registration)Tool registration with MCP server - defines tool name, description, input schema using Zod, and inline handler that calls searchFlags
// Tool 2: ffs_search_flag server.tool( 'ffs_search_flag', 'Search for FFS flags by keyword. Returns matching flags with their IDs and types.', { keyword: z.string().describe('Search keyword or complete Flag ID'), }, async ({ keyword }) => { try { const flags = await searchFlags(keyword); return { content: [ { type: 'text' as const, text: JSON.stringify({ found: flags.length > 0, count: flags.length, flags: flags.map((f) => ({ id: f.id, description: f.description || 'No description', dataType: f.dataType, status: f.status, })), message: flags.length === 0 ? 'No flags found. Please check the keyword.' : flags.length === 1 ? `Found exact match: ${flags[0].id}` : `Found ${flags.length} flags. Please specify the exact Flag ID.`, }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text' as const, text: JSON.stringify({ success: false, message: error instanceof Error ? error.message : 'Unknown error', }, null, 2), }, ], isError: true, }; } } ); - src/index.ts:71-73 (schema)Input schema definition using Zod - validates keyword parameter as required string
{ keyword: z.string().describe('Search keyword or complete Flag ID'), }, - src/types.ts:33-38 (schema)Type definition for FfsFlagSearchResult - defines the structure of flag search results returned by the handler
export interface FfsFlagSearchResult { id: string; description?: string; dataType: string; status: string; }