Skip to main content

LogSpanToolContent

Span content for tool executions. Use this type when logging tool or function calls that are invoked as part of an agentic workflow — for example, when an LLM requests a get_weather function call and your application executes it.

Import

import type { LogSpanToolContent } from '@adaline/api';
import { LogSpanToolContentTypeEnum } from '@adaline/api';

Type Definition

interface LogSpanToolContent {
  type: 'Tool';
  input: string;                   // JSON string (must be valid JSON)
  output: string;                  // JSON string (must be valid JSON)
}

Properties

  • type - Discriminator field, always 'Tool' for this content type
  • input - The tool call arguments as a JSON string (JSON.stringify() of the parameters)
  • output - The tool result as a JSON string (JSON.stringify() of the return value)
Both input and output must be valid, parseable JSON strings (the result of JSON.stringify()). Passing a plain string that isn’t valid JSON will cause the span to be rejected.

Example

async function getWeather(city: string): Promise<{ temp: number; conditions: string }> {
  const res = await fetch(`https://api.weather.example/v1?city=${city}`);
  return res.json();
}

const toolInput = { function: 'get_weather', arguments: { city: 'San Francisco' } };
const toolOutput = await getWeather(toolInput.arguments.city);

span.update({
  content: {
    type: 'Tool',
    input: JSON.stringify(toolInput),
    output: JSON.stringify(toolOutput),
  },
});

  • LogSpanContent — union type that includes LogSpanToolContent
  • LogSpanFunctionContent — for custom application logic (not LLM-triggered)
  • Span — class that accepts LogSpanContent via span.update()