evaluate_batch
Process multiple feature flag evaluations in a single request, optimizing decision-making workflows for AI assistants and LLMs through the Flipt MCP Server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requests | Yes |
Implementation Reference
- src/index.ts:729-753 (handler)MCP tool handler function that calls FliptClient.evaluateBatch with the input requests, formats the JSON response, and handles errors.async args => { try { const response = await fliptClient.evaluateBatch(args.requests); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error: any) { console.error('Error evaluating batch:', error); return { content: [ { type: 'text', text: `Failed to evaluate batch: ${error.message}`, }, ], isError: true, }; } }
- src/index.ts:719-728 (schema)Zod schema defining the input for the evaluate_batch tool: an array of requests each with namespaceKey, flagKey, entityId, and optional context.{ requests: z.array( z.object({ namespaceKey: z.string().min(1), flagKey: z.string().min(1), entityId: z.string().min(1), context: z.record(z.string()).optional(), }) ), },
- src/index.ts:718-754 (registration)Registration of the 'evaluate_batch' MCP tool on the server using server.tool(name, schema, handler).'evaluate_batch', { requests: z.array( z.object({ namespaceKey: z.string().min(1), flagKey: z.string().min(1), entityId: z.string().min(1), context: z.record(z.string()).optional(), }) ), }, async args => { try { const response = await fliptClient.evaluateBatch(args.requests); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error: any) { console.error('Error evaluating batch:', error); return { content: [ { type: 'text', text: `Failed to evaluate batch: ${error.message}`, }, ], isError: true, }; } } );
- src/services/fliptClient.ts:689-711 (helper)FliptClient helper method that maps the requests to API format and calls the generated evaluationApi.evaluateBatch.async evaluateBatch( requests: Array<{ namespaceKey: string; flagKey: string; entityId: string; context?: Record<string, string>; }> ) { try { const response = await this.evaluationApi.evaluateBatch({ requests: requests.map(req => ({ namespaceKey: req.namespaceKey, flagKey: req.flagKey, entityId: req.entityId, context: req.context || {}, })), }); return response; } catch (error) { console.error('Error evaluating batch:', error); throw error; } }