Annotation Interface McpToolBox


@Retention(RUNTIME) @Target(METHOD) public @interface McpToolBox
When used on a method of an AiService annotated with RegisterAiService, the method will use the tools provided by the MCP servers named in value. If no name is provided then the method will automatically use all the MCP servers available.

By default, the RegisterAiService won't use any tools provided by the configured MCP servers, so it is mandatory to add this annotation on methods that needs to use them.

Note that the filtering of the named MCP servers is possible only if the MCP extension is allowed to automatically generate a ToolProvider that is wired up to all the configured MCP clients, i.e. the quarkus.langchain4j.mcp.generate-tool-provider property is set to true (which is the default value). Conversely, if the AI service uses a custom ToolProvider than this annotation will have no effect and the wiring of specific MCP clients will have to be encoded in the ToolProvider itself.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    MCP servers to use.
  • Element Details

    • value

      String[] value
      MCP servers to use. In case no value is provided it will use all the MCP servers available.
      Default:
      {}