Interface McpTool


public interface McpTool

One tool on the server's MCP endpoint.

An @McpTool method becomes one of these through a class the build generates, whose schema is a constant and whose call(Map) converts the arguments and invokes the method directly. Write one by hand for a tool that is not a bean method, and pass it to McpServer.register(McpTool).

  • Method Summary

    Modifier and Type
    Method
    Description
    call(Map arguments)
    Runs the tool.
    What it does, for the agent choosing between tools.
    The JSON Schema of its arguments: an object schema, as a map.
    The tool's name, unique on the server.
  • Method Details

    • name

      String name()
      The tool's name, unique on the server.
    • description

      String description()
      What it does, for the agent choosing between tools.
    • inputSchema

      Map inputSchema()
      The JSON Schema of its arguments: an object schema, as a map.
    • call

      Object call(Map arguments) throws Exception

      Runs the tool. The result is written with Json as the call's text content.

      Throws
      • IllegalArgumentException: for arguments the tool cannot use, which the agent is told as a tool error it can correct
      Throws:
      Exception