Interface MetaCarrier.Builder<THIS extends MetaCarrier.Builder<THIS>>

Type Parameters:
THIS - the builder type
All Known Subinterfaces:
AudioContent.Builder, BlobResourceContents.Builder, CompletionResult.Builder, EmbeddedResource.Builder, ImageContent.Builder, ProgressNotification.Builder, PromptResponse.Builder, ResourceContents.Builder<THIS>, ResourceLink.Builder, ResourceResponse.Builder, TextContent.Builder, TextResourceContents.Builder, ToolResponse.Builder
Enclosing interface:
MetaCarrier

public static interface MetaCarrier.Builder<THIS extends MetaCarrier.Builder<THIS>>
Super-interface for builders which can include data in a _meta field.
  • Method Summary

    Modifier and Type
    Method
    Description
    putMetadata(String key, Object value)
    Adds a key value pair to the _meta entry of the object created by this builder.
    Sets the metadata, replacing any previously added metadata entries.
  • Method Details

    • putMetadata

      THIS putMetadata(String key, Object value)
      Adds a key value pair to the _meta entry of the object created by this builder.

      Note that the Model Context Protocol defines rules for the format of the key name. Implementations may validate the key name against these rules.

      Parameters:
      key - the key
      value - the value
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if key is not a valid metadata key name
    • setMetadata

      THIS setMetadata(Map<String,Object> metadata)
      Sets the metadata, replacing any previously added metadata entries.

      Note that the Model Context Protocol defines rules for the format of the key name. Implementations may validate the key names against these rules.

      Parameters:
      metadata - the metadata map
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if any of the keys of metadata are not valid metadata key names