Class McpToolRegistration<A>
- Type Parameters:
A- bound argument type
Registration is staged: choose a name, choose typed, fixed raw-JSON, or
authored-schema raw-JSON arguments, provide a handler, configure optional
metadata, and explicitly call build(). Typed and authored schemas
and their binding plans compile synchronously while the required inputs are
still in hand. A typed-output stage can select an always-complete handler,
an inline advanced handler, or a statically task-required operation handler
while retaining the same output contract.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classStaged selection of a tool's argument and output shapes.static final classBuilder for a tool that always completes with a supported structured Java result.static final classHandler-selection stage for a typed-output path.static final classBuilder for an advanced handler that returns theMcpOperationResultspine directly.static final classHandler-selection stage for the advanced operation-result path. -
Method Summary
Modifier and TypeMethodDescriptionReturns typed Apps association and audience metadata, if configured.Returns the normalized advanced handler.getIcons()Returns the input requests this advanced operation may emit.getName()Returns the Java output type from which Soklet derived a schema.Returns the direct rate-limiter override.Returns the named rate-limiter override.Returns the request-state contract for this operation.getTitle()Indicates whether structured content is also mirrored as canonical JSON text in the tool's content array.Begins a staged registration for a named tool.
-
Method Details
-
withName
public static @NonNull McpToolRegistration.ArgumentTypeStage withName(@NonNull String name, @NonNull Set<@NonNull McpProtocolVersion> protocolVersions) Begins a staged registration for a named tool.The next stage selects typed, fixed raw-JSON, or authored-schema raw-JSON arguments. Supplying both argument and output types selects a typed-output path whose next stage chooses inline completion or a statically task-required operation; supplying only an argument type selects the untyped advanced
McpOperationResultpath. No stage exposesbuild()before a handler has been supplied.- Parameters:
name- published MCP tool nameprotocolVersions- nonempty exact revisions serving this tool- Returns:
- argument-shape selection stage
- Throws:
IllegalArgumentException- if the name is not 1-128 characters fromA-Z,a-z,0-9, underscore, hyphen, and dot
-
getName
-
getProtocolVersions
- Returns:
- exact protocol revisions on which this tool is available
-
getTitle
-
getDescription
- Returns:
- human-readable description, if configured
-
getIcons
-
getArgumentType
- Returns:
- declared Java argument type
-
getInputSchema
- Returns:
- derived, fixed, or application-authored input schema
-
getOutputSchema
- Returns:
- generated output schema for a typed-output registration
-
getOutputType
Returns the Java output type from which Soklet derived a schema.- Returns:
- declared output type for a typed-output registration
-
getToolAnnotations
- Returns:
- advisory tool annotations, if configured
-
getAppToolMetadata
Returns typed Apps association and audience metadata, if configured.Raw application metadata remains separately available from
getMetadata(); this accessor does not parse raw Apps fields.- Returns:
- typed Apps tool metadata
-
getRateLimiterName
Returns the named rate-limiter override.At most one of this value and
getRateLimiter()is present.- Returns:
- limiter name, or empty for a direct or inherited limiter
-
getRateLimiter
Returns the direct rate-limiter override.At most one of this value and
getRateLimiterName()is present.- Returns:
- direct limiter, or empty for a named or inherited limiter
-
isStructuredContentMirroredAsText
Indicates whether structured content is also mirrored as canonical JSON text in the tool's content array.- Returns:
truewhen mirroring is enabled
-
getInputRequestDeclarations
Returns the input requests this advanced operation may emit.- Returns:
- immutable declarations in registration order
-
getRequestStateMode
Returns the request-state contract for this operation.- Returns:
- request-state mode
-
getMetadata
- Returns:
- immutable protocol extension metadata
-
getHandler
Returns the normalized advanced handler.For an always-complete typed registration, Soklet supplies an adapter that converts the Java result with the same compiled binding that generated
getOutputSchema().- Returns:
- normalized handler
-