Record Class McpServerFeatures.AsyncPromptRegistration

java.lang.Object
java.lang.Record
io.modelcontextprotocol.server.McpServerFeatures.AsyncPromptRegistration
Record Components:
prompt - The prompt definition including name and description
promptHandler - The function that processes prompt requests and returns formatted templates
Enclosing class:
McpServerFeatures

@Deprecated public static record McpServerFeatures.AsyncPromptRegistration(McpSchema.Prompt prompt, Function<McpSchema.GetPromptRequest,reactor.core.publisher.Mono<McpSchema.GetPromptResult>> promptHandler) extends Record
Deprecated.
This class is deprecated and will be removed in 0.9.0. Use McpServerFeatures.AsyncPromptSpecification.
Registration of a prompt template with its asynchronous handler function. Prompts provide structured templates for AI model interactions, supporting:
  • Consistent message formatting
  • Parameter substitution
  • Context injection
  • Response formatting
  • Instruction templating

Example prompt registration:


 new McpServerFeatures.AsyncPromptRegistration(
     new Prompt("analyze", "Code analysis template"),
     request -> {
         String code = request.getArguments().get("code");
         return Mono.just(new GetPromptResult(
             "Analyze this code:\n\n" + code + "\n\nProvide feedback on:"
         ));
     }
 )
 
  • Constructor Details

  • Method Details

    • toSpecification

      Deprecated.
    • toString

      public final String toString()
      Deprecated.
      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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Deprecated.
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Deprecated.
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • prompt

      public McpSchema.Prompt prompt()
      Deprecated.
      Returns the value of the prompt record component.
      Returns:
      the value of the prompt record component
    • promptHandler

      public Function<McpSchema.GetPromptRequest,reactor.core.publisher.Mono<McpSchema.GetPromptResult>> promptHandler()
      Deprecated.
      Returns the value of the promptHandler record component.
      Returns:
      the value of the promptHandler record component