Package io.modelcontextprotocol.server
Record Class McpServerFeatures.AsyncToolSpecification
java.lang.Object
java.lang.Record
io.modelcontextprotocol.server.McpServerFeatures.AsyncToolSpecification
- Record Components:
tool- The tool definition including name, description, and parameter schemacall- Deprecated. Use thecallHandlerinstead.callHandler- The function that implements the tool's logic, receiving aMcpAsyncServerExchangeand aMcpSchema.CallToolRequestand returning results. The function's first argument is anMcpAsyncServerExchangeupon which the server can interact with the connected client. The second arguments is a map of tool arguments.
- Enclosing class:
- McpServerFeatures
public static record McpServerFeatures.AsyncToolSpecification(McpSchema.Tool tool, BiFunction<McpAsyncServerExchange,Map<String,Object>,reactor.core.publisher.Mono<McpSchema.CallToolResult>> call, BiFunction<McpAsyncServerExchange,McpSchema.CallToolRequest,reactor.core.publisher.Mono<McpSchema.CallToolResult>> callHandler)
extends Record
Specification of a tool with its asynchronous handler function. Tools are the
primary way for MCP servers to expose functionality to AI models. Each tool
represents a specific capability.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating AsyncToolSpecification instances. -
Constructor Summary
ConstructorsConstructorDescriptionAsyncToolSpecification(McpSchema.Tool tool, BiFunction<McpAsyncServerExchange, Map<String, Object>, reactor.core.publisher.Mono<McpSchema.CallToolResult>> call) Deprecated.Use {@link AsyncToolSpecification(McpSchema.Tool, null, BiFunction)} instead.AsyncToolSpecification(McpSchema.Tool tool, BiFunction<McpAsyncServerExchange, Map<String, Object>, reactor.core.publisher.Mono<McpSchema.CallToolResult>> call, BiFunction<McpAsyncServerExchange, McpSchema.CallToolRequest, reactor.core.publisher.Mono<McpSchema.CallToolResult>> callHandler) Creates an instance of aAsyncToolSpecificationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder instance.BiFunction<McpAsyncServerExchange,Map<String, Object>, reactor.core.publisher.Mono<McpSchema.CallToolResult>> call()Deprecated.BiFunction<McpAsyncServerExchange,McpSchema.CallToolRequest, reactor.core.publisher.Mono<McpSchema.CallToolResult>> Returns the value of thecallHandlerrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.tool()Returns the value of thetoolrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AsyncToolSpecification
@Deprecated public AsyncToolSpecification(McpSchema.Tool tool, BiFunction<McpAsyncServerExchange, Map<String, Object>, reactor.core.publisher.Mono<McpSchema.CallToolResult>> call) Deprecated.Use {@link AsyncToolSpecification(McpSchema.Tool, null, BiFunction)} instead. -
AsyncToolSpecification
public AsyncToolSpecification(McpSchema.Tool tool, @Deprecated BiFunction<McpAsyncServerExchange, Map<String, Object>, reactor.core.publisher.Mono<McpSchema.CallToolResult>> call, BiFunction<McpAsyncServerExchange, McpSchema.CallToolRequest, reactor.core.publisher.Mono<McpSchema.CallToolResult>> callHandler) Creates an instance of aAsyncToolSpecificationrecord class.- Parameters:
tool- the value for thetoolrecord componentcall- the value for thecallrecord componentcallHandler- the value for thecallHandlerrecord component
-
-
Method Details
-
builder
Creates a new builder instance.- Returns:
- a new Builder instance
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
tool
Returns the value of thetoolrecord component.- Returns:
- the value of the
toolrecord component
-
call
@Deprecated public BiFunction<McpAsyncServerExchange,Map<String, call()Object>, reactor.core.publisher.Mono<McpSchema.CallToolResult>> Deprecated.Returns the value of thecallrecord component.- Returns:
- the value of the
callrecord component
-
callHandler
public BiFunction<McpAsyncServerExchange,McpSchema.CallToolRequest, callHandler()reactor.core.publisher.Mono<McpSchema.CallToolResult>> Returns the value of thecallHandlerrecord component.- Returns:
- the value of the
callHandlerrecord component
-