Package io.modelcontextprotocol.server
Record Class McpStatelessServerFeatures.SyncPromptSpecification
java.lang.Object
java.lang.Record
io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification
- Record Components:
prompt- The prompt definition including name and descriptionpromptHandler- The function that processes prompt requests and returns formatted templates. The function's argument is aMcpSchema.GetPromptRequest.
- Enclosing class:
- McpStatelessServerFeatures
public static record McpStatelessServerFeatures.SyncPromptSpecification(McpSchema.Prompt prompt, BiFunction<McpTransportContext,McpSchema.GetPromptRequest,McpSchema.GetPromptResult> promptHandler)
extends Record
Specification of a prompt template with its synchronous handler function. Prompts
provide structured templates for AI model interactions, supporting:
- Consistent message formatting
- Parameter substitution
- Context injection
- Response formatting
- Instruction templating
-
Constructor Summary
ConstructorsConstructorDescriptionSyncPromptSpecification(McpSchema.Prompt prompt, BiFunction<McpTransportContext, McpSchema.GetPromptRequest, McpSchema.GetPromptResult> promptHandler) Creates an instance of aSyncPromptSpecificationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.prompt()Returns the value of thepromptrecord component.Returns the value of thepromptHandlerrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SyncPromptSpecification
public SyncPromptSpecification(McpSchema.Prompt prompt, BiFunction<McpTransportContext, McpSchema.GetPromptRequest, McpSchema.GetPromptResult> promptHandler) Creates an instance of aSyncPromptSpecificationrecord class.- Parameters:
prompt- the value for thepromptrecord componentpromptHandler- the value for thepromptHandlerrecord component
-
-
Method Details
-
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). -
prompt
Returns the value of thepromptrecord component.- Returns:
- the value of the
promptrecord component
-
promptHandler
public BiFunction<McpTransportContext,McpSchema.GetPromptRequest, promptHandler()McpSchema.GetPromptResult> Returns the value of thepromptHandlerrecord component.- Returns:
- the value of the
promptHandlerrecord component
-