Skip to content

Commit 1a9badd

Browse files
committed
Adding comments
1 parent b4a6221 commit 1a9badd

File tree

4 files changed

+47
-4
lines changed

4 files changed

+47
-4
lines changed

src/app.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ export function webPubSub(name: string, options: WebPubSubFunctionOptions): void
146146
generic(name, convertToGenericOptions(options, trigger.webPubSub));
147147
}
148148

149+
/**
150+
* Registers an MCP Tool function in your app.
151+
* This function is triggered by MCP Tool events and allows you to define the behavior of the function.
152+
*
153+
* @param name - The name of the function. This must be unique within your app and is primarily used for tracking purposes.
154+
* @param options - Configuration options for the MCP Tool function, including the handler and trigger-specific settings.
155+
*/
149156
export function mcpTool(name: string, options: McpToolFunctionOptions): void {
150157
generic(name, convertToGenericOptions(options, trigger.mcpTool));
151158
}

src/trigger.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ export function webPubSub(options: WebPubSubTriggerOptions): WebPubSubTrigger {
128128
});
129129
}
130130

131+
/**
132+
* Creates an MCP Tool trigger configuration.
133+
* This function is used to define an MCP Tool trigger for an Azure Function.
134+
*
135+
* @param options - The configuration options for the MCP Tool trigger, including tool-specific metadata.
136+
* @returns An MCP Tool trigger object with the specified configuration.
137+
*/
131138
export function mcpTool(options: McpToolTriggerOptions): McpToolTrigger {
132139
return addTriggerBindingName({
133140
...options,

types/mcpTool.d.ts

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,57 @@
44
import { FunctionOptions, FunctionResult, FunctionTrigger } from './index';
55
import { InvocationContext } from './InvocationContext';
66

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+
*/
714
export type McpToolTriggerHandler = (messages: unknown, context: InvocationContext) => FunctionResult;
815

16+
/**
17+
* Configuration options for an MCP Tool function.
18+
* This includes trigger-specific options and general function options.
19+
*/
920
export interface McpToolFunctionOptions extends McpToolTriggerOptions, Partial<FunctionOptions> {
21+
/**
22+
* The handler function to execute when the trigger is invoked.
23+
*/
1024
handler: McpToolTriggerHandler;
1125

26+
/**
27+
* The trigger configuration for the MCP Tool.
28+
*/
1229
trigger?: McpToolTrigger;
1330
}
1431

32+
/**
33+
* Configuration options for an MCP Tool trigger.
34+
* These options define the behavior and metadata for the trigger.
35+
*/
1536
export interface McpToolTriggerOptions {
1637
/**
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.
1840
*/
1941
toolName: string;
2042

2143
/**
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.
2346
*/
2447
description: string;
2548

2649
/**
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.
2852
*/
2953
toolProperties?: Record<string, unknown>;
3054
}
55+
56+
/**
57+
* Represents an MCP Tool trigger, combining base function trigger options
58+
* with MCP Tool-specific trigger options.
59+
*/
3160
export type McpToolTrigger = FunctionTrigger & McpToolTriggerOptions;

types/trigger.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function mySql(options: MySqlTriggerOptions): MySqlTrigger;
9292
export function webPubSub(options: WebPubSubTriggerOptions): WebPubSubTrigger;
9393

9494
/**
95-
* [Link to docs and examples](https://docs.microsoft.com/azure/azure-functions/functions-bindings-web-pubsub-trigger?pivots=programming-language-javascript)
95+
* [Link to docs and examples](//TODO Add link to docs and examples)
9696
*/
9797
export function mcpTool(options: McpToolFunctionOptions): McpToolTrigger;
9898

0 commit comments

Comments
 (0)