# Wrap a REST API with web_get

> This is the no-code path for the **tools** surface described in [Integrations](/docs/agents/integrations): exposing a single third-party REST endpoint to an agent without deploying anything.

This is the no-code path for the **tools** surface described in [Integrations](/docs/agents/integrations): exposing a single third-party REST endpoint to an agent without deploying anything.

`web_get` is the built-in HTTP fetcher. It supports GET, POST, PUT, PATCH, DELETE, and HEAD. Out of the box the agent chooses the URL, method, headers, and body, and gets back the raw response plus envelope fields the model doesn't need. Usable for ad-hoc browsing, weak as a tool. Four configuration fields turn it into a purpose-built client for one API: rename it after the verb it implements, rewrite its description, pin every argument the LLM shouldn't pick, and project the response to the fields the model should reason over.

## The four ingredients

All four fields live on the agent's `tool_configurations` entry.

The **map key** is the name the agent sees. Don't call it `fetch_url`; call it `get_github_issue` or `lookup_jira_ticket`. The agent decides whether to call a tool from this name, so it should read like the verb it implements.

The **`description`** field overrides the default tool description shown to the agent. Write one or two sentences that describe what the tool does, what input it expects, and when to reach for it. Describe the API you're wrapping, not the mechanics of `web_get`.

The **`argument_override`** field hardcodes any of the underlying `WebGetToolParameters` you don't want the LLM to decide: `method`, the static parts of `headers`, the request `body`, `max_body_bytes`, `timeout_seconds`, `head_lines`, `tail_lines`, `max_content_bytes`, even the `url` itself for a zero-input tool. Anything in this map is invisible to the agent; anything you leave out remains its responsibility.

The **`output_transform`** field is a [jq](https://jqlang.github.io/jq/) expression applied to the response before it reaches the model. The raw `WebGetResponse` carries `response_headers`, `total_lines`, `truncated`, and the redirected `url` alongside the body. For most wrapped APIs the only thing worth showing the agent is the parsed body. Project aggressively.

## Example: a document fetcher

A natural pairing for `corpora_search`: the built-in search tool returns snippets, but an agent often needs the full document body to reason over. Vectara's [`GET /v2/corpora/{corpus_key}/documents/{document_id}`](/docs/rest-api/corpora) endpoint returns the whole document, and there is no built-in tool that wraps it. This configuration is that wrapper.

The agent chooses only the `url`, built from a corpus key and a document id it has seen in a search hit. The method, API key, accept header, timeout, and truncation are pinned. The response is projected to the id, the metadata, and the document text joined from `parts[]`.

<CodePanel
  title="A Vectara document fetcher built on web_get"
  layout="stacked"
  snippets={[{
    language: 'json',
    code: `{
  "tool_configurations": {
    "get_corpus_document": {
      "type": "web_get",
      "description": "Fetch the full content and metadata of a document in a Vectara corpus. Input: a https://api.vectara.io/v2/corpora/{corpus_key}/documents/{document_id} URL (percent-encode the document_id). Returns the document id, its metadata, and the document text joined from its parts. Use after a corpora_search hit when the agent needs the full body, not just the matching snippets.",
      "argument_override": {
        "method": "GET",
        "headers": {
          "Accept": "application/json",
          "x-api-key": "zwt_xxxxxxxxxxxxxxxx"
        },
        "timeout_seconds": 10,
        "head_lines": 500,
        "tail_lines": 0,
        "max_content_bytes": 131072
      },
      "output_transform": ".content | fromjson | {id, metadata, text: ([.parts[].text] | join(\"\\n\\n\"))}"
    }
  }
}`
  }]}
  annotations={{
    json: [
      { line: 3, text: 'The map key is the name the agent sees. Pick a verb that matches the wrapped API.' },
      { line: 5, text: 'Override the description so the agent reasons about a document lookup, not about a generic web fetcher.' },
      { line: 6, text: 'argument_override hides every field listed here from the LLM. Everything not listed is still chosen by the agent; here that is just url.' },
      { line: 13, text: 'head_lines / max_content_bytes truncate the response server-side before the transform runs, which is the cheap place to drop large documents.' },
      { line: 17, text: 'Parse the body as JSON, keep three fields, and join the parts[] array into a single text blob. The transform errors out if the response is not JSON, which surfaces to the agent as a tool error it can react to.' }
    ]
  }}
/>

## Rules of thumb

Hardcode every field the LLM doesn't need to choose. Each free parameter is one more chance the agent picks something nonsensical, and every fixed parameter is one fewer thing the description has to explain.

Truncate before you transform. `head_lines`, `tail_lines`, and `max_content_bytes` run on the server before bytes ship back; `output_transform` runs on whatever made it through. Doing both keeps a runaway page from blowing up the context window even if the transform happens to keep the whole body.

Bound what the agent can send, not just what it gets back. `max_body_bytes` caps the UTF-8 byte length of the request `body`, from 1024 (1 KB) to 4194304 (4 MB), defaulting to 65536 (64 KB). A request whose body exceeds the limit is rejected without being sent. Raise it when the wrapped API expects payloads larger than the default; lower it when the tool writes to an API and you want a ceiling on any single call.

Don't paste secrets into `argument_override`. Reference an [agent secret](/docs/agents/secrets) instead, so credentials aren't stored alongside the agent definition and can rotate without touching the configuration.

If the integration needs logic the description can't express (chained calls, response pagination, OAuth refresh), stop and reach for a [lambda tool](/docs/agents/lambda-tools) or [MCP](/docs/agents/model-context-protocol). `web_get` is the right tool when one request maps to one tool call.

For the bigger picture of how tools sit alongside data sources and connectors, see [Integrations](/docs/agents/integrations). For more on `output_transform` and pairing the fetcher with `web_search`, see [Transforming tool output](/docs/agents/tools#transforming-tool-output-before-the-llm-sees-it).
