This document describes how tool/function calling is represented in OpenInference spans.
Tools available to the LLM are represented using the llm.tools prefix with flattened attributes:
Attribute Pattern
The json_schema contains the complete tool definition as a JSON string, including:
- Tool type (usually “function”)
- Function name
- Function description
- Parameter schema
When an LLM generates tool calls, they are represented in the output messages:
Where:
<messageIndex> is the zero-based index of the message
<toolCallIndex> is the zero-based index of the tool call within the message
<attribute> is the specific tool call attribute
tool_call.id: Unique identifier for the tool call
tool_call.function.name: Name of the function being called
tool_call.function.arguments: JSON string containing the function arguments
When an LLM makes multiple tool calls in a single response:
Tool results are typically represented as input messages with role “tool”:
The message.tool_call_id links the result back to the original tool call. The message.name attribute MAY be set to identify which function produced the result — it typically matches tool_call.function.name from the corresponding tool call.
1. User Request
5. Final Response
Legacy Attributes
Some implementations may use legacy attributes for function calling. New implementations should use the tool_calls structure described above.
Legacy attributes:
message.function_call_name: Function name (deprecated, use tool_calls)
message.function_call_arguments_json: Function arguments (deprecated, use tool_calls)
llm.function_call: Complete function call as JSON (deprecated)