xAI tools — index (server-side agentic tools, function calling, MCP)
Status: DOCUMENTED + LIVE_VERIFIED (2026-09-19 with grok-4.3 on /v1/responses: function, web_search, x_search, code_interpreter(+alias code_execution), file_search(+alias collections_search), mcp called live; image_generation, shell accepted without being invoked; tool_search ACCOUNT_RESTRICTED (alpha); live_search RETIRED). Machine-readable: generated/fragments/tools/xai-tools.json, parameters/xai-responses.json (tools[] rows), streaming-events/xai-inference.json, objects/xai-inference-objects.json.
Sources: https://docs.x.ai/developers/tools/overview · …/function-calling · …/web-search · …/x-search · …/code-execution · …/collections-search · …/remote-mcp · …/citations · …/streaming-and-sync · …/tool-usage-details · …/advanced-usage · https://docs.x.ai/developers/pricing#tools-pricing · OpenAPI ModelTool, Tool
Last verified: 2026-09-19
Exact type strings
The Responses deserializer lists (422 error text): function, web_search, x_search, image_generation, collections_search, file_search, code_execution, code_interpreter, mcp, shell, tool_search. Chat Completions accepts only function and live_search.
type |
Category | xai-sdk helper | Endpoints | Live 2026-09-19 | Page |
|---|---|---|---|---|---|
function |
client | xai_sdk.chat.tool(...) |
Responses, Chat, Messages (Anthropic shape) | LIVE_VERIFIED (forced, parallel, round trip, stream) | function-calling |
web_search |
server | web_search() |
Responses | LIVE_VERIFIED (web_search_call action open_page) |
web-search |
x_search |
server | x_search() |
Responses | LIVE_VERIFIED — items come back as custom_tool_call (docs: x_search_call) |
x-search |
code_interpreter / alias code_execution |
server | code_execution() |
Responses | LIVE_VERIFIED (code_interpreter_call, logs stdout) |
code-execution |
file_search / alias collections_search |
server | collections_search(collection_ids=[…]) |
Responses | LIVE_VERIFIED shape (file_search_call failed on un-indexed collection) |
collections-search |
mcp |
mcp | mcp(server_url, server_label) |
Responses, Speech-to-Speech | LIVE_VERIFIED (DeepWiki mcp_call) |
mcp |
image_generation |
server | — | Responses | accepted (not invoked) — images agent | https://docs.x.ai/developers/tools/image-generation |
shell (env local) |
client | — | Responses | accepted (not invoked) | OpenAPI only |
tool_search + defer_loading |
hosted | — | Responses | 403 "only available for alpha users" | OpenAPI only |
(implicit) attachment search via input_file |
server | xai_sdk.chat.file(...) |
Responses | LIVE_VERIFIED | ../../xai/files.md |
(sub-tools) view_image, view_x_video, search_images |
server | enable_image_understanding, enable_video_understanding, enable_image_search flags |
via web_search / x_search | flags accepted | image-understanding |
live_search (+ search_parameters, web_search_options) |
legacy | — | Chat | 410 RETIRED | ../../xai/chat-completions.md |
Output item ↔ usage counter ↔ price
| Item type (Responses) | server_side_tool_usage_details |
xai-sdk category | Price |
|---|---|---|---|
web_search_call |
web_search_calls |
SERVER_SIDE_TOOL_WEB_SEARCH (web_search, web_search_with_snippets, browse_page, open_page, open_page_with_find); IMAGE_SEARCH (search_images) |
$5 / 1k calls |
custom_tool_call (x_*) |
x_search_calls |
SERVER_SIDE_TOOL_X_SEARCH (x_user_search, x_keyword_search, x_semantic_search, x_thread_fetch) |
$5 / 1k calls → from 2026-09-21 12:00 PT $5 / 1k posts + $10 / 1k profiles |
code_interpreter_call |
code_interpreter_calls |
SERVER_SIDE_TOOL_CODE_EXECUTION | $5 / 1k |
file_search_call |
file_search_calls (+ document_search_calls) |
SERVER_SIDE_TOOL_COLLECTIONS_SEARCH | $2.50 / 1k |
mcp_call |
mcp_calls |
SERVER_SIDE_TOOL_MCP ({label}.{tool}) |
tokens only |
image_generation_call |
image_generation_calls |
— | Imagine rates |
| (attachment search) | — | attachment_search | $10 / 1k |
| view_image / view_x_video | — | SERVER_SIDE_TOOL_VIEW_IMAGE / VIEW_X_VIDEO | image tokens only |
Only successful executions are billed. include values: web_search_call.action.sources, code_interpreter_call.outputs, file_search_call.results, reasoning.encrypted_content, no_inline_citations. Loop mechanics: ../../xai/tool-loop.md. Examples: examples/xai/tools/<tool>/. Tests: tests/xai/test_tools.py (server tools gated by RUN_EXPENSIVE_TESTS).