Package io.modelcontextprotocol.server
Record Class McpStatelessServerFeatures.SyncToolSpecification
java.lang.Object
java.lang.Record
io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification
- Record Components:
tool- The tool definition including name, description, and parameter schemacallHandler- The function that implements the tool's logic, receiving aMcpSchema.CallToolRequestand returning results.
- Enclosing class:
- McpStatelessServerFeatures
public static record McpStatelessServerFeatures.SyncToolSpecification(McpSchema.Tool tool, BiFunction<McpTransportContext,McpSchema.CallToolRequest,McpSchema.CallToolResult> callHandler)
extends Record
Specification of a tool with its synchronous handler function. Tools are the
primary way for MCP servers to expose functionality to AI models.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating SyncToolSpecification instances. -
Constructor Summary
ConstructorsConstructorDescriptionSyncToolSpecification(McpSchema.Tool tool, BiFunction<McpTransportContext, McpSchema.CallToolRequest, McpSchema.CallToolResult> callHandler) Creates an instance of aSyncToolSpecificationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()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
-
SyncToolSpecification
public SyncToolSpecification(McpSchema.Tool tool, BiFunction<McpTransportContext, McpSchema.CallToolRequest, McpSchema.CallToolResult> callHandler) Creates an instance of aSyncToolSpecificationrecord class.- Parameters:
tool- the value for thetoolrecord componentcallHandler- the value for thecallHandlerrecord component
-
-
Method Details
-
builder
-
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
-
callHandler
public BiFunction<McpTransportContext,McpSchema.CallToolRequest, callHandler()McpSchema.CallToolResult> Returns the value of thecallHandlerrecord component.- Returns:
- the value of the
callHandlerrecord component
-