पेज · Laravilt
Tools
Give AI models functions to call for querying and changing data.
Tools are functions a model can call through chatWithTools(). Every tool extends Laravilt\AI\Tools\Tool.
| Page | Description |
|---|---|
| Query tool | Search and sort model records |
| CRUD tools | Create, update and delete records |
| Custom tools | Write your own tools |
Built-in tools
| Class | Description |
|---|---|
QueryTool | Search and order records |
CreateTool | Create a record from fillable fields |
UpdateTool | Update a record by id |
DeleteTool | Delete (soft or force) a record by id |
ResourceQueryTool | Static helper behind the chat's list_resources and query_resource tools |
Calling tools
Pass tool definitions ($tool->toArray()) to chatWithTools(), run the calls, then send the results back:
php
Each tool call has id, name and decoded arguments.