GGateYourWay API
Status RU Create key
Agents

Tool calling

Send tool definitions to the model, execute the call in your application, and return the result with the same ID.

01

OpenAI tools

json
{
  "model": "gpt-5.6-luna",
  "messages": [{"role": "user", "content": "What is the weather in Moscow?"}],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_weather",
      "description": "Get current weather",
      "parameters": {
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"]
      }
    }
  }]
}

The response may contain message.tool_calls. Return each result as a tool message with the matching tool_call_id.

02

Anthropic tool_use

Preserve the assistant block containing tool_use, execute the tool, and append a user tool_result block.

json
{
  "role": "user",
  "content": [{
    "type": "tool_result",
    "tool_use_id": "toolu_...",
    "content": "18 C, clear"
  }]
}
03

Reliable loop

  1. Do not alter tool-call IDs.
  2. Preserve assistant and tool-result ordering.
  3. When streaming, accumulate arguments until complete JSON is available.
  4. After executing a tool, keep reading until visible text or the next tool call.