Tool definitions#
Pass tools with type: function and a function name, description and JSON Schema parameters. Set additionalProperties: false for bounded argument shapes. Enable only models whose serving parser has been verified.
Execute the tool#
A tool call is a request from the model, not an instruction that must be trusted. Validate the tool name and arguments against your allowlist. Run the operation with the current user’s permissions.
Return the result#
Append the assistant tool_calls message, then a role: tool message with matching tool_call_id and string content. Send the conversation again to obtain the final answer.
Streaming arguments#
Accumulate deltas by tool-call index and parse arguments only after completion. Roo Code requires native tools; plain chat compatibility is insufficient.
Request example
curl https://weightsapi.com/v1/chat/completions \
-H "Authorization: Bearer $WEIGHTSAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen3-32B",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"stream": true
}'