|
4 | 4 | import { FunctionOptions, FunctionResult, FunctionTrigger } from './index'; |
5 | 5 | import { InvocationContext } from './InvocationContext'; |
6 | 6 |
|
| 7 | +/** |
| 8 | + * A handler function for MCP Tool triggers. |
| 9 | + * |
| 10 | + * @param messages - The messages or data received by the trigger. |
| 11 | + * @param context - The invocation context for the function. |
| 12 | + * @returns A result that can be a promise or a synchronous value. |
| 13 | + */ |
7 | 14 | export type McpToolTriggerHandler = (messages: unknown, context: InvocationContext) => FunctionResult; |
8 | 15 |
|
| 16 | +/** |
| 17 | + * Configuration options for an MCP Tool function. |
| 18 | + * This includes trigger-specific options and general function options. |
| 19 | + */ |
9 | 20 | export interface McpToolFunctionOptions extends McpToolTriggerOptions, Partial<FunctionOptions> { |
| 21 | + /** |
| 22 | + * The handler function to execute when the trigger is invoked. |
| 23 | + */ |
10 | 24 | handler: McpToolTriggerHandler; |
11 | 25 |
|
| 26 | + /** |
| 27 | + * The trigger configuration for the MCP Tool. |
| 28 | + */ |
12 | 29 | trigger?: McpToolTrigger; |
13 | 30 | } |
14 | 31 |
|
| 32 | +/** |
| 33 | + * Configuration options for an MCP Tool trigger. |
| 34 | + * These options define the behavior and metadata for the trigger. |
| 35 | + */ |
15 | 36 | export interface McpToolTriggerOptions { |
16 | 37 | /** |
17 | | - * An app setting (or environment variable) with the service bus connection string |
| 38 | + * The name of the tool associated with the trigger. |
| 39 | + * This is typically an app setting or environment variable. |
18 | 40 | */ |
19 | 41 | toolName: string; |
20 | 42 |
|
21 | 43 | /** |
22 | | - * An app setting (or environment variable) with the service bus connection string |
| 44 | + * A description of the tool or trigger. |
| 45 | + * This provides additional context about the trigger's purpose. |
23 | 46 | */ |
24 | 47 | description: string; |
25 | 48 |
|
26 | 49 | /** |
27 | | - * A dictionary of arguments associated with the trigger. |
| 50 | + * Additional properties or metadata for the tool. |
| 51 | + * This is a dictionary of key-value pairs that can be used to configure the trigger. |
28 | 52 | */ |
29 | 53 | toolProperties?: Record<string, unknown>; |
30 | 54 | } |
| 55 | + |
| 56 | +/** |
| 57 | + * Represents an MCP Tool trigger, combining base function trigger options |
| 58 | + * with MCP Tool-specific trigger options. |
| 59 | + */ |
31 | 60 | export type McpToolTrigger = FunctionTrigger & McpToolTriggerOptions; |
0 commit comments