Output Types

Understanding tool output formats

Overview

anytool supports three output types: JSON, HTML, and plain text. The type is automatically detected based on your tool's implementation.

JSON

JSON output is ideal for structured data that will be consumed programmatically.

When to Use

  • Returning multiple values or complex data structures
  • Data that will be parsed by other applications
  • API-style responses

Example Tools

  • "Parse CSV and return JSON"
  • "Calculate loan details (monthly payment, total interest, etc)"
  • "Analyze text and return word count, character count, and reading time"

Example Output

{
  "bmi": 22.5,
  "category": "Normal weight",
  "healthy_range": "18.5 - 24.9"
}

HTML

HTML output allows you to create rich, interactive visualizations and UI elements.

When to Use

  • Visual results (charts, graphs, diagrams)
  • Formatted content with styling
  • Interactive elements
  • QR codes, barcodes, or images

Example Tools

  • "Generate QR code from URL"
  • "Create bar chart from data"
  • "Render markdown as formatted HTML"
  • "Display color palette with hex codes"

Capabilities

HTML output can include:

  • Inline CSS for styling
  • SVG graphics
  • Canvas elements
  • Tables and lists
  • Forms (read-only in playground)

Limitations

  • No external scripts or stylesheets
  • Limited interactivity (static rendering)
  • Sandboxed environment

Plain Text

Simple text output for straightforward results.

When to Use

  • Single values or simple responses
  • Status messages
  • Validation results
  • Generated text content

Example Tools

  • "Generate random UUID"
  • "Validate email address (returns 'Valid' or 'Invalid')"
  • "Generate Lorem ipsum paragraph"
  • "Calculate percentage change"

Example Output

550e8400-e29b-41d4-a716-446655440000

Choosing an Output Type

The output type is determined by what your tool returns:

  • If the tool returns HTML tags, it's rendered as HTML
  • If the tool returns a JavaScript object, it's serialized to JSON
  • Otherwise, it's displayed as plain text

You can influence this by being specific in your prompt about the desired format.

Viewing Output

In the playground:

  • JSON: Displayed with syntax highlighting and proper formatting
  • HTML: Rendered in an iframe for security
  • Text: Displayed in a monospace font

API Responses

When using tools via MCP or API, the response includes:

  • The output content
  • The detected output type
  • Execution metadata (duration, status, etc)