1- import { DynamicResourceAction , GenerateResponse , genkit , ModelReference , ToolAction } from 'genkit' ;
1+ import {
2+ Action ,
3+ DynamicResourceAction ,
4+ GenerateResponse ,
5+ genkit ,
6+ ModelReference ,
7+ ToolAction ,
8+ } from 'genkit' ;
29import { GenkitMcpHost , McpServerConfig , createMcpHost } from '@genkit-ai/mcp' ;
310import { GenkitPlugin , GenkitPluginV2 } from 'genkit/plugin' ;
411import { z } from 'zod' ;
@@ -21,10 +28,18 @@ import {MODEL_PROVIDERS} from './models.js';
2128import { UserFacingError } from '../../utils/errors.js' ;
2229import { GenkitModelProvider , PromptDataForCounting } from './model-provider.js' ;
2330import { ToolLogEntry } from '../../shared-interfaces.js' ;
31+ import { toToolDefinition } from 'genkit/tool' ;
2432
2533const globalLogger = new GenkitLogger ( ) ;
2634logger . init ( globalLogger ) ;
2735
36+ /**
37+ * Gets the name of a Genkit action.
38+ */
39+ function getActionName ( action : Action < any , any > ) : string {
40+ return toToolDefinition ( action ) . name ;
41+ }
42+
2843/** Runner that uses the Genkit API under the hood. */
2944export class GenkitRunner implements LlmRunner {
3045 readonly id = 'genkit' ;
@@ -217,8 +232,8 @@ export class GenkitRunner implements LlmRunner {
217232 const tools = await this . mcpHost . getActiveTools ( this . genkitInstance ) ;
218233 const resources = await this . mcpHost . getActiveResources ( this . genkitInstance ) ;
219234 return {
220- tools : tools . map ( t => t . __action . name ) ,
221- resources : resources . map ( r => r . __action . name ) ,
235+ tools : tools . map ( getActionName ) ,
236+ resources : resources . map ( getActionName ) ,
222237 } ;
223238 }
224239
0 commit comments