Package su.onno.mcp

Annotation Interface McpTool


@Target(METHOD) @Retention(RUNTIME) @Documented public @interface McpTool
Exposes a Spring bean method as an MCP tool.

Ordinary method parameters become tool inputs. A Principal, McpToolContext, or MCP server exchange parameter is supplied by the starter and is not included in the input schema.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Description shown to MCP clients.
    boolean
    MCP destructive safety hint.
    boolean
    MCP idempotent safety hint.
    Tool name advertised to MCP clients.
    boolean
    MCP open-world safety hint.
    Optional JSON Schema for the returned value.
    boolean
    MCP read-only safety hint.
    Roles allowed to call the tool.
    Short human-readable title.
  • Element Details

    • name

      String name
      Tool name advertised to MCP clients. Defaults to the Java method name.
      Default:
      ""
    • title

      String title
      Short human-readable title. Defaults to the tool name.
      Default:
      ""
    • description

      String description
      Description shown to MCP clients.
      Default:
      ""
    • roles

      String[] roles
      Roles allowed to call the tool. Empty means any authenticated user.
      Default:
      {}
    • readOnly

      boolean readOnly
      MCP read-only safety hint. Non-read-only tools obey onno.mcp.writes-enabled.
      Default:
      true
    • destructive

      boolean destructive
      MCP destructive safety hint.
      Default:
      false
    • idempotent

      boolean idempotent
      MCP idempotent safety hint.
      Default:
      false
    • openWorld

      boolean openWorld
      MCP open-world safety hint.
      Default:
      false
    • outputSchema

      String outputSchema
      Optional JSON Schema for the returned value.
      Default:
      ""