Skip to main content

ToolCallContent

Tool/function call request from an LLM with arguments and metadata.

Import

import type { ToolCallContent } from '@adaline/api';

Type Definition

interface ToolCallContent {
  modality: 'tool-call';
  index: number;
  id: string;
  name: string;
  arguments: string;
  serverName?: string | null;
}

Fields

modality
string
required
Must be "tool-call".
index
number
required
Zero-based index of the tool call. Minimum: 0.
id
string
required
Unique identifier for this tool call.
name
string
required
Name of the function to call.
arguments
string
required
JSON-encoded string of function arguments.
serverName
string | null
Optional MCP server name associated with this tool call.

Example

import type { ToolCallContent, PromptMessage } from '@adaline/api';

const toolCall: ToolCallContent = {
  modality: 'tool-call',
  index: 0,
  id: 'call_abc123',
  name: 'get_weather',
  arguments: JSON.stringify({
    city: 'San Francisco',
    units: 'fahrenheit'
  }),
  serverName: 'weather-api'
};

const message: PromptMessage = {
  role: 'assistant',
  content: [toolCall]
};
JSON:
{
  "modality": "tool-call",
  "index": 0,
  "id": "call_abc123",
  "name": "get_weather",
  "arguments": "{\"city\":\"San Francisco\",\"units\":\"fahrenheit\"}"
}