---
title: Tool Call with Filters
---
sequenceDiagram
    participant Client
    participant Plugin
    participant Kernel
    participant AI Service
    participant LLM
    Client->>+AI Service: Invoke Chat Completion with Auto Function Call
    AI Service->>+LLM: Chat Completion
    LLM->>-AI Service: Tool Call Request
    AI Service->>+Kernel: Tool Call Invoking Filter
    Kernel->>-AI Service: Tool Call Invoking Filter
    AI Service->>AI Service: Update Local Chat History
    loop For Each Tool in Tool Call request
    AI Service->>+Kernel: Function Call
    Kernel->>+Plugin: Invoke Function
    Plugin->>-Kernel: Function Result
    Kernel->>-AI Service: Function Call Result
    end
    AI Service->>+Kernel: Tool Call Invoked Filter
    Kernel->>-AI Service: Tool Call Invoked Filter
    AI Service->>AI Service: Update Local Chat History
    AI Service->>+LLM: Tool Call Response
    LLM->>-AI Service: Chat Completion Response
    AI Service->>AI Service: Update Local Chat History
    AI Service->>-Client: Chat Completion Response
