@azure/functions package
Classes
| AppStartContext |
Context on a function app during app startup. |
| AppTerminateContext |
Context on a function app during app termination. |
| Disposable |
Represents a type which can release resources, such as event listening or a timer. |
| HookContext |
Base class for all hook context objects |
| HttpRequest |
HTTP request object. Provided to your function when using HTTP Bindings. |
| HttpResponse |
HTTP response class |
| InvocationContext |
Contains metadata and helper methods specific to this invocation |
| InvocationHookContext |
Base class for all invocation hook context objects |
| LogHookContext |
Context on a log |
| McpAudioContent |
An audio content block in an MCP tool response. |
| McpContentBlock |
Abstract base class for MCP tool response content blocks. The Azure Functions library discriminates content blocks from plain user values using
Plain object literals like Extending with custom content block typesIf the MCP spec adds a new block type — or your scenario needs a custom one — you can
ship your own subclass without any library change. The converter only checks
Example: adding a hypothetical
|
| McpImageContent |
An image content block in an MCP tool response. |
| McpPromptArgumentBuilder |
Fluent builder for declaring MCP prompt arguments in a record-shaped
By default arguments are optional; call Example
|
| McpResourceContent |
An embedded-resource content block in an MCP tool response. |
| McpResourceLinkContent |
A resource-link content block in an MCP tool response. |
| McpTextContent |
A text content block in an MCP tool response. |
| McpToolResponse |
Full MCP tool response with explicit content blocks and optional structured content.
Return an instance of this class from a tool handler when you need full control over
both the content array and
|
| PostInvocationContext |
Context on a function after it executes. |
| PreInvocationContext |
Context on a function before it executes. |
| PromptInvocationContext |
Structured context object passed to MCP prompt handlers. Provides typed access to the invoked prompt's name, arguments (all values are strings), optional session id, and optional transport metadata. Example
|
Interfaces
| AppStartContextInit |
Object passed to AppStartContext constructors. For testing purposes only |
| AppTerminateContextInit |
Object passed to AppTerminateContext constructors. For testing purposes only |
| ConnectorTriggerFunctionOptions | |
| ConnectorTriggerOptions | |
| Cookie |
Http response cookie object to "Set-Cookie" |
| CosmosDBv3FunctionOptions | |
| CosmosDBv3InputOptions | |
| CosmosDBv3OutputOptions | |
| CosmosDBv3TriggerOptions | |
| CosmosDBv4AllVersionsAndDeletesFunctionOptions | |
| CosmosDBv4ChangeFeedItem |
Full-fidelity change feed item payload emitted when |
| CosmosDBv4ChangeFeedMetadata |
Metadata included with each change feed item when using |
| CosmosDBv4InputOptions | |
| CosmosDBv4LatestVersionFunctionOptions | |
| CosmosDBv4OutputOptions | |
| CosmosDBv4TriggerOptions | |
| Duration | |
| EffectiveFunctionOptions |
The options used when registering the function, as passed to a specific invocation NOTE: This value may differ slightly from the original because it has been validated and defaults may have been explicitly added |
| EventGridEvent | |
| EventGridFunctionOptions |
At this point in time there are no event grid trigger-specific options |
| EventGridOutputConnectionOptions | |
| EventGridOutputKeyOptions | |
| EventGridPartialEvent |
Link to docs and examples This "partial" interface is meant to be used when creating an event yourself and allows some properties to be left out |
| EventGridTriggerOptions |
At this point in time there are no event grid trigger-specific options |
| EventHubFunctionOptions | |
| EventHubOutputOptions | |
| EventHubTriggerOptions | |
| Exception | |
| ExponentialBackoffRetryOptions | |
| FixedDelayRetryOptions | |
| FunctionInput |
Full configuration for the secondary input to a function ("trigger" is the primary input) NOTE: Not all triggers can be used as secondary inputs |
| FunctionOptions |
Configures the inputs, outputs, and handler for an Azure Function |
| FunctionOutput |
Full configuration for the output to a function |
| FunctionTrigger |
Full configuration for the primary input to a function |
| GenericFunctionOptions |
Configures the inputs, outputs, and handler for an Azure Function |
| GenericInputOptions | |
| GenericOutputOptions | |
| GenericTriggerOptions | |
| HookContextInit |
Base interface for objects passed to HookContext constructors. For testing purposes only. |
| HttpFunctionOptions | |
| HttpOutputOptions |
At this point in time there are no http output specific options |
| HttpRequestBodyInit |
For testing purposes only. This will always be constructed for you when run in the context of the Azure Functions runtime |
| HttpRequestInit |
For testing purposes only. This will always be constructed for you when run in the context of the Azure Functions runtime |
| HttpRequestUser |
Object representing logged-in user, either through AppService/Functions authentication, or SWA Authentication |
| HttpResponseInit | |
| HttpTrigger |
Full configuration for the primary input to a function |
| HttpTriggerOptions | |
| IToolPropertyBuilder |
Interface for the fluent API builder for creating MCP Tool properties This acts as a bridge between the implementation and type declarations |
| InvocationContextExtraInputs |
An object used to get secondary inputs |
| InvocationContextExtraOutputs |
An object used to set secondary outputs |
| InvocationContextInit |
For testing purposes only. This will always be constructed for you when run in the context of the Azure Functions runtime |
| InvocationHookContextInit |
Object passed to InvocationHookContext constructors. For testing purposes only |
| LogHookContextInit |
Object passed to LogHookContext constructors. For testing purposes only |
| McpAudioContentInit |
Initializer for |
| McpImageContentInit |
Initializer for |
| McpPromptArgument |
Describes a single argument accepted by an MCP prompt. |
| McpPromptFunctionOptions |
Configuration options for an MCP Prompt function. This includes trigger-specific options and general function options. |
| McpPromptTriggerOptions |
Configuration options for an MCP Prompt trigger. These options define the behavior and metadata for the trigger. |
| McpPromptTriggerOptionsToRpc |
The wire-format options sent to the Functions host for an MCP Prompt trigger.
|
| McpResourceContentInit |
Initializer for |
| McpResourceFunctionOptions |
Configuration options for an MCP Resource function. This includes trigger-specific options and general function options. |
| McpResourceLinkContentInit |
Initializer for |
| McpResourceTriggerOptions |
Configuration options for an MCP Resource trigger. These options define the behavior and metadata for the trigger. |
| McpToolFunctionOptions |
Configuration options for an MCP Tool function. This includes trigger-specific options and general function options. |
| McpToolProperty | |
| McpToolResponseInit |
Initializer for |
| McpToolTriggerOptions |
Configuration options for an MCP Tool trigger. These options define the behavior and metadata for the trigger. |
| McpToolTriggerOptionsToRpc |
Configuration options for an MCP Tool trigger. These options define the behavior and metadata for the trigger. |
| MySqlChange | |
| MySqlFunctionOptions | |
| MySqlInputOptions | |
| MySqlOutputOptions | |
| MySqlTriggerOptions | |
| PostInvocationContextInit |
Object passed to PostInvocationContext constructors. For testing purposes only |
| PreInvocationContextInit |
Object passed to PreInvocationContext constructors. For testing purposes only |
| RetryContext | |
| ServiceBusQueueFunctionOptions | |
| ServiceBusQueueOutputOptions | |
| ServiceBusQueueTriggerOptions | |
| ServiceBusTopicFunctionOptions | |
| ServiceBusTopicOutputOptions | |
| ServiceBusTopicTriggerOptions | |
| SetupOptions | |
| SqlChange | |
| SqlFunctionOptions | |
| SqlInputOptions | |
| SqlOutputOptions | |
| SqlTriggerOptions | |
| StorageBlobFunctionOptions | |
| StorageBlobOptions | |
| StorageBlobTriggerOptions | |
| StorageQueueFunctionOptions | |
| StorageQueueOptions | |
| TableInputOptions | |
| TableOutputOptions | |
| Timer |
Timer schedule information. Provided to your function when using a timer binding. |
| TimerFunctionOptions | |
| TimerTriggerOptions | |
| TraceContext |
TraceContext information to enable distributed tracing scenarios |
| WarmupContext | |
| WarmupFunctionOptions | |
| WarmupTriggerOptions | |
| WebPubSubConnectionInputOptions | |
| WebPubSubContextInputOptions | |
| WebPubSubFunctionOptions | |
| WebPubSubOutputOptions | |
| WebPubSubTriggerOptions | |
Type Aliases
| AppStartHandler |
Handler for app start hooks |
| AppTerminateHandler |
Handler for app terminate hooks |
| Arg |
Represents a tool property definition (same as McpToolProperty but without propertyName) |
| Args |
Tool properties format - an object mapping property names to their definitions |
| ConnectorTrigger | |
| ConnectorTriggerHandler | |
| CosmosDBChangeFeedItem | |
| CosmosDBChangeFeedMetadata | |
| CosmosDBFunctionOptions | |
| CosmosDBHandler | |
| CosmosDBInput | |
| CosmosDBInputOptions | |
| CosmosDBOutput | |
| CosmosDBOutputOptions | |
| CosmosDBTrigger | |
| CosmosDBTriggerOptions | |
| CosmosDBv3Handler | |
| CosmosDBv3Input | |
| CosmosDBv3Output | |
| CosmosDBv3Trigger | |
| CosmosDBv4FullFidelityFunctionOptions | |
| CosmosDBv4FunctionOptions | |
| CosmosDBv4Handler | |
| CosmosDBv4Input | |
| CosmosDBv4Output | |
| CosmosDBv4Trigger | |
| EventGridHandler | |
| EventGridOutput | |
| EventGridOutputOptions | |
| EventGridTrigger | |
| EventHubHandler | |
| EventHubOutput | |
| EventHubTrigger | |
| FunctionHandler | |
| FunctionResult |
Void if no |
| HttpHandler | |
| HttpHeadersInit |
Represents the headers types that can be used to initialize HTTP headers. This is a local definition to avoid dependency on lib.dom. Compatible with Node.js native Fetch API header types. |
| HttpMethod |
Possible values for an HTTP request method. |
| HttpMethodFunctionOptions | |
| HttpOutput | |
| HttpRequestParams |
Route parameter keys and values. |
| HttpRequestUserType |
Possible values for an HTTP Request user type |
| HttpResponseBodyInit |
Represents the body types that can be used in an HTTP response. This is a local definition to avoid dependency on lib.dom. Compatible with Node.js native Fetch API body types. Includes Node.js Readable streams and AsyncIterable for HTTP streaming scenarios. |
| LogCategory | |
| LogHandler | |
| LogHookHandler |
Handler for log hooks. |
| LogLevel | |
| McpPromptArguments |
Accepted shapes for declaring prompt arguments.
|
| McpPromptTrigger |
Represents an MCP Prompt trigger, combining base function trigger options with MCP Prompt-specific trigger options. |
| McpPromptTriggerHandler |
A handler function for MCP Prompt triggers. |
| McpResourceTrigger |
Represents an MCP Resource trigger, combining base function trigger options with MCP Resource-specific trigger options. |
| McpResourceTriggerHandler |
A handler function for MCP Resource triggers. |
| McpToolTrigger |
Represents an MCP Tool trigger, combining base function trigger options with MCP Tool-specific trigger options. |
| McpToolTriggerHandler |
A handler function for MCP Tool triggers. |
| MySqlHandler | |
| MySqlInput | |
| MySqlOutput | |
| MySqlTrigger | |
| PostInvocationHandler |
Handler for post-invocation hooks |
| PreInvocationHandler |
Handler for pre-invocation hooks. |
| RetryOptions | |
| ServiceBusQueueHandler | |
| ServiceBusQueueOutput | |
| ServiceBusQueueTrigger | |
| ServiceBusTopicHandler | |
| ServiceBusTopicOutput | |
| ServiceBusTopicTrigger | |
| SqlHandler | |
| SqlInput | |
| SqlOutput | |
| SqlTrigger | |
| StorageBlobHandler | |
| StorageBlobInput | |
| StorageBlobInputOptions | |
| StorageBlobOutput | |
| StorageBlobOutputOptions | |
| StorageBlobTrigger | |
| StorageQueueHandler | |
| StorageQueueOutput | |
| StorageQueueOutputOptions | |
| StorageQueueTrigger | |
| StorageQueueTriggerOptions | |
| TableInput | |
| TableOutput | |
| TimerHandler | |
| TimerTrigger | |
| TriggerMetadata |
Metadata related to the input that triggered your function |
| WarmupHandler | |
| WarmupTrigger | |
| WebPubSubConnectionInput | |
| WebPubSubContextInput | |
| WebPubSubHandler | |
| WebPubSubOutput | |
| WebPubSubTrigger | |
Enums
| CosmosDBv4ChangeFeedMode |
Change feed mode for Cosmos DB trigger bindings. |
| MySqlChangeOperation | |
| SqlChangeOperation | |
Functions
| Mcp |
Marks a class or constructor function as an MCP result type that should be serialized as structured content. When a function returns an instance of a type decorated with this marker, the result will be serialized as both text content (for backwards compatibility) and structured content (for clients that support it). Without the marker, a plain object is serialized as text-only (JSON stringified).
Use Programmatic usage (works without
Decorator usage (requires
Supported forms:
See McpToolResponseSee For explicit content blocks + structuredContent See McpTextContentSee For returning single content blocks |
| Mcp |
Variables
| arg | Factory function to create a new tool property builder Example
|
| prompt |
Factory for creating MCP prompt argument builders. Kept separate from the tool-property |
Function Details
McpContent<T>(T)
Marks a class or constructor function as an MCP result type that should be serialized as structured content.
When a function returns an instance of a type decorated with this marker, the result will be serialized as both text content (for backwards compatibility) and structured content (for clients that support it).
Without the marker, a plain object is serialized as text-only (JSON stringified).
Use McpToolResponse if you need explicit control over structuredContent without a class.
Programmatic usage (works without experimentalDecorators):
class ImageMetadata {
constructor(public imageId: string, public format: string) {}
}
McpContent(ImageMetadata); // marks the class
app.mcpTool('GetImage', {
toolName: 'GetImage',
description: 'Returns image info',
handler: async () => new ImageMetadata('logo', 'png')
});
Decorator usage (requires experimentalDecorators: true in tsconfig):
@McpContent
class ImageMetadata { ... }
Supported forms:
@McpContent@McpContent()McpContent(MyClass)
See McpToolResponseSee For explicit content blocks + structuredContent See McpTextContentSee For returning single content blocks
function McpContent<T>(target: T): T
Parameters
- target
-
T
Optional class or constructor function to mark for structured content.
Returns
T
The target class/function unchanged or a class decorator.
McpContent()
function McpContent(): (target: T) => T
Returns
(target: T) => T
Variable Details
arg
Factory function to create a new tool property builder
Example
const toolProperties = {
snippetName: arg
.string()
.describe("Some Description"),
optionalField: arg
.number()
.describe("Optional number field")
.optional(),
};
arg: { boolean() => IToolPropertyBuilder, datetime() => IToolPropertyBuilder, double() => IToolPropertyBuilder, integer() => IToolPropertyBuilder, long() => IToolPropertyBuilder, number() => IToolPropertyBuilder, object() => IToolPropertyBuilder, string() => IToolPropertyBuilder }
Type
{ boolean() => IToolPropertyBuilder, datetime() => IToolPropertyBuilder, double() => IToolPropertyBuilder, integer() => IToolPropertyBuilder, long() => IToolPropertyBuilder, number() => IToolPropertyBuilder, object() => IToolPropertyBuilder, string() => IToolPropertyBuilder }
promptArg
Factory for creating MCP prompt argument builders.
Kept separate from the tool-property arg helper because prompt arguments
are untyped (only name, optional description, and a required flag).
promptArg: { describe(description: string) => McpPromptArgumentBuilder }
Type
{ describe(description: string) => McpPromptArgumentBuilder }