Annotation Interface McpTool


Declares an MCP tool handler method.

Soklet's annotation processor derives the input schema from parameters annotated with McpToolArgument. For an ordinary typed-completion method, it derives the output schema from the declared return type. A method returning McpTaskCreatedResult is statically task-only and derives its eventual output schema from the result's type argument; Soklet rejects a client without the Tasks capability before invoking it. Other methods returning McpOperationResult or a subtype use the dynamic advanced-result path and have no derived output schema. McpToolProperty customizes property metadata on ordinary typed input and output records.

A statically task-only method may accept one unannotated McpTaskCreationContext parameter directly. The same context remains available through McpInvocationFeatures for dynamic handlers. A task-control parameter must not be annotated with McpToolArgument.

Author:
Mark Allen
  • Element Details

    • protocolVersions

      Exact MCP revisions on which this tool is available. At least one is required, and every revision must be exposed by the owning endpoint.
      Returns:
      supported protocol revisions
    • name

      The tool name published to MCP clients.
      Returns:
      the nonblank tool name
    • title

      The optional human-readable tool title.
      Returns:
      the title, or an empty string if none is configured
      Default:
      ""
    • description

      The optional human-readable tool description.
      Returns:
      the description, or an empty string if none is configured
      Default:
      ""
    • rateLimiterName

      Names a server-registered rate limiter for this tool.

      An empty value inherits the endpoint or server tool rate limiter. A nonempty value must identify an entry in the server's rate-limiter registry.

      Returns:
      the rate-limiter name, or an empty string to inherit
      Default:
      ""
    • structuredContentMirroredAsText

      Whether Soklet mirrors structured tool output into a text content block.
      Returns:
      true to mirror structured content as text
      Default:
      true
    • mayRequestInput

      Client requests this tool may emit during multi-round-trip handling.

      A nonempty declaration requires the method to return McpOperationResult or a subtype.

      Returns:
      input-request declarations
      Default:
      {}
    • requestStateMode

      The request-state contract for this tool.

      A mode other than McpRequestStateMode.NONE requires the method to return McpOperationResult or a subtype.

      Returns:
      request-state mode
      Default:
      NONE