function_calling
Call functions using Grok AI based on user input by processing message arrays and tool definitions to execute specific actions.
Instructions
Use Grok AI to call functions based on user input
Input Schema
Name | Required | Description | Default |
---|---|---|---|
messages | Yes | Array of message objects with role and content | |
model | No | Grok model to use (e.g., grok-2-latest, grok-3, grok-3-reasoner, grok-3-deepsearch, grok-3-mini-beta) | grok-3-mini-beta |
tool_choice | No | Tool choice mode (auto, required, none) | auto |
tools | Yes | Array of tool objects with type, function name, description, and parameters |
Input Schema (JSON Schema)
{
"properties": {
"messages": {
"description": "Array of message objects with role and content",
"items": {
"properties": {
"content": {
"description": "Content of the message",
"type": "string"
},
"role": {
"description": "Role of the message sender (system, user, assistant, tool)",
"enum": [
"system",
"user",
"assistant",
"tool"
],
"type": "string"
},
"tool_call_id": {
"description": "ID of the tool call (for tool messages)",
"type": "string"
}
},
"required": [
"role",
"content"
],
"type": "object"
},
"type": "array"
},
"model": {
"default": "grok-3-mini-beta",
"description": "Grok model to use (e.g., grok-2-latest, grok-3, grok-3-reasoner, grok-3-deepsearch, grok-3-mini-beta)",
"type": "string"
},
"tool_choice": {
"default": "auto",
"description": "Tool choice mode (auto, required, none)",
"enum": [
"auto",
"required",
"none"
],
"type": "string"
},
"tools": {
"description": "Array of tool objects with type, function name, description, and parameters",
"items": {
"type": "object"
},
"type": "array"
}
},
"required": [
"messages",
"tools"
],
"type": "object"
}