Skip to main content
Lesson 1 of 16 · Integrated Tools: Web, X, Code

The Two Categories of Grok Tools

Lesson 1 of 16 Updated July 30, 2026 Developer
On this page
  1. Understand the Grok API Tool Ecosystem
  2. Built-in Tools — Server-Side
  3. Function Calling — Client-Side
  4. When to Use Each Category
  5. Key Takeaways

Understand the Grok API Tool Ecosystem

Overview of tools in the documentation The Grok API does more than generate text. It provides a set of tools that let the model interact with the outside world: searching for real-time information, analyzing data on social media, or running Python code. To leverage these capabilities, you need to understand how they are organized.

The Grok API distinguishes two fundamental categories of tools. This distinction determines who executes the tool, where processing takes place, and what you need to manage as a developer.

Built-in Tools — Server-Side

Built-in tools run directly on xAI’s servers. When the model decides to use one of these tools, execution is automatic and transparent. You don’t need to manage any infrastructure or process intermediate results.

🔍
Web Search
Real-time web search
𝕏
X Search
Search on X/Twitter
🐍
Code Execution
Isolated Python sandbox
📁
Collections Search
Search within your documents
🔌
Remote MCP
External MCP servers

Here are the five available built-in tools:

  • Web Search (web_search): Real-time web search, with domain filtering and automatic citations
  • X Search (x_search): Search on X/Twitter, with account and date filtering
  • Code Execution (code_interpreter / code_execution): Python code execution in a secure sandboxed environment
  • Collections Search (collections_search / file_search): Search within documents you previously uploaded
  • Remote MCP (mcp): Connect to external MCP (Model Context Protocol) servers

To enable a built-in tool, simply add it to the tools array in your request:

{
  "tools": [{"type": "web_search"}]
}

Function Calling — Client-Side

Function Calling works differently. You define custom functions that the model can call. But unlike built-in tools, your client-side code executes the function and returns the result to the model.

The flow is as follows:

  1. You describe your functions (name, parameters, description) in the request
  2. The model analyzes the user’s request
  3. If it determines a function is needed, it returns a function call with arguments
  4. Your code executes the function (API call, database query, calculation…)
  5. You send the result back to the model
  6. The model formulates its final response

This approach gives you full control: you decide what your functions do, what data they handle, and how they connect to your infrastructure.

When to Use Each Category

Built-in tools are ideal when you need access to real-time information (web, social media) or need to run calculations without managing infrastructure. Function Calling is preferable when you need to interact with your own systems: internal databases, business APIs, or any service specific to your application.

You can combine both categories in a single request. For example, you can enable Web Search while defining a custom function that saves the results to your database.

Key Takeaways

  • The Grok API offers two categories of tools: built-in tools (executed by xAI) and Function Calling (executed by your code)
  • Built-in tools require no client-side infrastructure
  • Function Calling offers full control but requires more development
  • Both categories can be combined in a single request
  • This course focuses on the three main built-in tools: Web Search, X Search, and Code Execution