Annotation Type McpToolTrigger
-
@Target(PARAMETER) @Retention(RUNTIME) public @interface McpToolTriggerTriggers an Azure Function when invoked by the Model Context Protocol (MCP) tool system.This annotation enables Azure Functions to be called as tools from MCP-compatible clients like AI assistants. The annotated parameter receives tool invocation arguments and context.
Example:
@FunctionName("getFileContent") public HttpResponseMessage getFile( @McpToolTrigger( name = "request", description = "Reads file content", toolProperties = "[{\"propertyName\":\"filePath\",\"propertyType\":\"string\"," + "\"description\":\"File path to read\"}]" ) String toolRequest ) { // Parse and handle tool request }- Since:
- 3.2.0
- See Also:
McpToolProperty
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.StringnameThe binding name for the tool invocation context parameter.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringdataTypeDefines how Functions runtime should treat the parameter value.java.lang.StringdescriptionHuman-readable description of what this tool does.java.lang.StringtoolPropertiesJSON array defining expected tool properties.
-
-
-
-
dataType
java.lang.String dataType
Defines how Functions runtime should treat the parameter value. Possible values are:- "": get the value as a string, and try to deserialize to actual parameter type like POJO
- string: always get the value as a string
- binary: get the value as a binary data, and try to deserialize to actual parameter type byte[]
- Returns:
- The dataType which will be used by the Functions runtime.
- Default:
- ""
-
-
-
toolProperties
java.lang.String toolProperties
JSON array defining expected tool properties.Each property should be a JSON object with: propertyName, propertyType, description. Alternative: use
McpToolPropertyannotations on parameters.Example:
[{"propertyName":"fileName","propertyType":"string","description":"File to read"}]- Returns:
- JSON array of property definitions, or empty string
- Default:
- ""
-
-