---
name: kimaai_stream_tool_call
type: filter
since: 1.4.1
tier: free
feature: none
area: tools-addons
summary: Runs a tool that no kimaai_chatbot_tool_call callback answered; deprecated for kimaai_chatbot_tool_call.
parameters:
  - name: result
    type: mixed
    description: Null, or the result an earlier callback of this filter returned.
  - name: name
    type: string
    description: The tool's name.
  - name: args
    type: array
    description: The arguments the model sent, decoded from JSON.
  - name: payload
    type: array
    description: The same payload as in kimaai_chatbot_tool_call.
returns:
  type: mixed
  description: Null to leave the call unanswered, else the tool's result.
surfaces: [chatbot, admin_assistant, search]
deprecated:
  since: 1.6.0
  replacement: kimaai_chatbot_tool_call
  removal: 1.8.0
---

# kimaai_stream_tool_call

## When it fires

Right after `kimaai_chatbot_tool_call`, with the same arguments, but only when no callback of that filter answered the call. It still works, and WordPress gives its deprecation notice when a callback is hooked to it. Despite its name it is not limited to streamed answers. Move to `kimaai_chatbot_tool_call` at a priority below 10.

With KimaAI Pro it gets no calls: the tool router answers every tool on `kimaai_chatbot_tool_call` at priority 10, so the result is never `null` here. In the free version it runs for a tool that no callback of the new filter answered.

## Example

```php
add_filter(
  'kimaai_stream_tool_call',
  function ($result, string $name, array $args) {
    if ($result !== null || $name !== 'my_gift_wrap_price') {
      return $result;
    }

    return ['price' => '3.50 EUR', 'note' => 'Gift wrap is free on orders over 50 EUR.'];
  },
  10,
  3
);
```

## More examples

The same with `kimaai_chatbot_tool_call`, which also runs with KimaAI Pro:

```php
add_filter(
  'kimaai_chatbot_tool_call',
  function ($result, string $name, array $args) {
    if ($result !== null || $name !== 'my_gift_wrap_price') {
      return $result;
    }

    return ['price' => '3.50 EUR', 'note' => 'Gift wrap is free on orders over 50 EUR.'];
  },
  5,
  3
);
```

## Related

- `kimaai_chatbot_tool_call`: the replacement.
