Annotation Type McpToolTrigger


  • @Target(PARAMETER)
    @Retention(RUNTIME)
    public @interface McpToolTrigger
    Triggers 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.String name
      The binding name for the tool invocation context parameter.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String dataType
      Defines how Functions runtime should treat the parameter value.
      java.lang.String description
      Human-readable description of what this tool does.
      java.lang.String toolProperties
      JSON array defining expected tool properties.
    • Element Detail

      • name

        java.lang.String name
        The binding name for the tool invocation context parameter.
        Returns:
        The parameter binding name
      • 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:
        ""
      • description

        java.lang.String description
        Human-readable description of what this tool does.
        Returns:
        Description of the tool's functionality
        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 McpToolProperty annotations on parameters.

        Example:

         [{"propertyName":"fileName","propertyType":"string","description":"File to read"}]
         
        Returns:
        JSON array of property definitions, or empty string
        Default:
        ""