SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
13 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
2.2 KB · 32 lines markdown
Rendered Raw Blame History
1# xAI Remote MCP tool (`type: "mcp"`)23**Status:** DOCUMENTED · LIVE_VERIFIED (2026-09-19, grok-4.3 → https://mcp.deepwiki.com/mcp: `mcp_call` `ask_question` on `xai-org/xai-sdk-python`, `mcp_calls: 1`, answer "Python SDK for xAI language models chat.")4**Sources:** https://docs.x.ai/developers/tools/remote-mcp · https://docs.x.ai/developers/tools/tool-usage-details · https://docs.x.ai/developers/advanced-api-usage/batch-api (MCP in batch) · OpenAPI `ModelTool` (mcp variant), `McpCall`5**Last verified:** 2026-09-1967## Parameters8| Field | Required | Notes |9|---|---|---|10| `server_url` | yes | Streamable HTTP or SSE transport only |11| `server_label` | yes | prefixes tool names in usage (`{label}.{tool}`) |12| `server_description` | no | helps tool selection |13| `allowed_tools` | no | string[]; empty = all tools injected into context (xai-sdk: `allowed_tool_names`) |14| `authorization` | no | bearer token sent to the MCP server |15| `headers` | no | extra headers (xai-sdk: `extra_headers`) |16| `require_approval`, `connector_id` | docs: not supported | live: `require_approval:"never"` silently accepted |17| `defer_loading` | alpha | 403 |1819Multiple MCP servers per request allowed. Also usable in Speech-to-Speech and Batch requests.2021## Output22```json23{"type":"mcp_call","id":"mcp_<resp>_call-…-0","status":"completed","name":"ask_question","server_label":"deepwiki","error":"",24 "arguments":"{\"repoName\":[\"xai-org/xai-sdk-python\"],\"question\":\"what does the repo do?\"}","output":"{\"content\":[{\"type\":\"text\",\"text\":\"This repository…\"}]}"}25```26`output` is always returned (no include needed). No `mcp_list_tools` item and **no approval round-trip** (unlike OpenAI). Response echoes `tools:[{type:"mcp", server_label, server_url, allowed_tools:[], headers:{}, server_description:""}]`. Live usage: 4 024 total tokens (555 reasoning, MCP output counted as input), cost ticks 55 721 500 ≈ $0.0056.2728## Billing / security29No per-call fee — tokens only. Use HTTPS; xAI forwards your `authorization`/`headers` to the server; restrict with `allowed_tools` (read-only) and keep server metadata descriptive.3031Examples: `examples/xai/tools/mcp/`. Test: `tests/xai/test_tools.py::test_mcp_tool` (RUN_EXPENSIVE_TESTS).32