Class ToolExampleSpec

java.lang.Object
com.tnsai.metadata.ToolExampleSpec

public class ToolExampleSpec extends Object
Immutable metadata about a tool usage example. Extracted from ToolExampleSpec annotation.

Following ADR-006: Immutable Models

Author:
TnsAI Team
See Also:
  • Constructor Details

    • ToolExampleSpec

      public ToolExampleSpec(ToolExample annotation)
      Creates example metadata from annotation.
      Parameters:
      annotation - the ToolExample annotation
    • ToolExampleSpec

      public ToolExampleSpec(String description, String input, String output, boolean negative, String whyBad)
      Creates example metadata with all fields.
      Parameters:
      description - example description
      input - JSON input string
      output - expected output
      negative - whether this is a negative example
      whyBad - explanation for negative examples
  • Method Details

    • from

      public static ToolExampleSpec from(ToolExample annotation)
      Factory method to create from annotation.
      Parameters:
      annotation - the ToolExample annotation
      Returns:
      new ToolExampleSpec instance
    • hasDescription

      public boolean hasDescription()
      Checks if this example has a description.
      Returns:
      true if description is not empty
    • hasOutput

      public boolean hasOutput()
      Checks if this example has output.
      Returns:
      true if output is not empty
    • isPositive

      public boolean isPositive()
      Checks if this is a positive (good) example.
      Returns:
      true if not a negative example
    • toFormattedString

      public String toFormattedString()
      Formats the example for inclusion in prompts or documentation.
      Returns:
      formatted example string