LLM Tool Calling Integration Guide: Built-in Tools vs. Standalone APIs

    This guide explains how the shift of tool execution from the client to the server changes LLM integration decisions. It covers why built-in tools and custom tools cannot be mixed in the same request, which scenarios suit built-in tools versus standalone APIs, and how a two-stage fetch pattern (summary first, full text on demand) controls token usage. A pre-integration checklist on intent routing, input cleaning, context budgeting, caching, observability, fallback, and compliance helps you pick the right entry point and avoid costly rework.

    1. What Actually Changed: Tool Execution Moved from the Client to the Server

    A new pattern is emerging in how LLM capabilities are exposed to developers. Capabilities such as web search, web page content extraction, file parsing, text recognition, and speech processing are now offered in two forms: built-in server-side tools and standalone capability APIs. Most developers start by scanning the capability list, then get stuck on the same question: with a row of APIs in front of you, which one do you integrate first?

    To answer that, look at what really changed. It is not the number of capabilities, but where the tool executes.

    The traditional approach is the classic function calling pattern: the model emits a structured call request, the caller’s own server performs the search, fetch, and parsing, and the raw results are stitched back into the context so the model can keep reasoning. On this path, the caller pays for the compute, and the full text of every fetched page or file counts toward the context length, which inflates the cost of each request.

    The new pattern moves execution to the server. The caller only declares a built-in tool in the request; the search, link opening, content extraction, and format conversion all happen server-side, and only the processed result enters the context. An analogy: previously you sent a courier out to pick up the parcel, carried it home, and unpacked and shelved it yourself; now the warehouse ships and shelves the goods directly, and you just take them off the shelf. The difference is not whether you get the goods, but who handles the intermediate steps, and whether what ends up occupying your context is raw material or a finished product.

    This migration has three direct consequences, which are the basis for every selection decision that follows:

    • Lower context usage: what enters the context is a structured result rather than the full raw text, leaving more room for the business conversation.
    • Lower implementation cost: no need to build your own search service, fetching service, and parsing pipeline; integration drops from “write a service” to “write a declaration field.”
    • Lower controllability: execution happens on the server, so the caller has weaker direct control over crawl scope, cleaning rules, and retry policies.

    2. The Boundary Between the Two Paths: Why Built-in and Custom Tools Cannot Be Mixed

    According to the public API documentation, built-in tools and caller-defined custom tools cannot be mixed in the same request. This constraint is often misread as a capability difference, but it is actually a request structure limitation: built-in tools execute inside the server-side flow, while custom tools require handing control back to the caller, and the two execution models cannot both hold within a single request.

    This yields a clear decision rule:

    • For pure conversation enhancement, hand everything to built-in tools; the request structure is the simplest.
    • Once the request also needs to call your own tools (for example, your knowledge base search or internal business queries), the built-in path no longer works and you must switch to standalone APIs and orchestrate them yourself.

    The root cause of many projects “integrating the wrong entry point” is right here: they get built-in tools working with a pure chat demo, then later need to connect their own knowledge base without restructuring the request, which leaves the context stuffed with irrelevant web pages, or causes files to be uploaded and parsed repeatedly, producing unexpected consumption.

    3. Scenario-Based Selection: Where Chat Enhancement and Agent Orchestration Diverge

    3.1 When Built-in Tools Fit

    A typical case is a standard chat client that wants answers to include the latest information. You declare a web-search built-in tool in the request, and the model decides on its own whether a search is needed, summarizes the results, and cites sources, so the caller maintains no fetching or cleaning logic. The same idea applies to one-off document understanding, extracting text from images, speech transcription, and other “process on input” needs.

    The criteria come down to three points: no custom tools need to participate; there is no strong need to customize the intermediate process; and you want the shortest path to launch.

    3.2 When Standalone APIs Fit

    An agent with its own knowledge base search is a different case. Here the search scope, recall strategy, and result ranking are all defined by the business side. The correct approach is to wrap search and content fetching as two ordinary tools and let the model orchestrate them, with the token budget fully under your own control.

    A schematic tool declaration and call loop (pseudocode, structure only):

    1. tools = [
    2. {"name": "search", "description": "Return title, summary, relevance score, and link for a query",
    3. "parameters": {"query": "string", "top_k": "int"}},
    4. {"name": "fetch", "description": "Return page content as Markdown for a link",
    5. "parameters": {"url": "string"}}
    6. ]
    7. while True:
    8. resp = model.chat(messages, tools=tools)
    9. if not resp.tool_calls:
    10. break
    11. for call in resp.tool_calls:
    12. if call.name == "search":
    13. result = search(call.query, top_k=call.top_k, need_content=False)
    14. else:
    15. result = fetch(call.url)
    16. messages.append(tool_result(call.id, result))

    4. A Mechanism Worth Borrowing: Two-Stage Content Fetching

    On the standalone API path, the most instructive design is summary first, full text on demand. In no-content mode, the search API returns only the title, summary snippets, and relevance scores; the model reads the summaries to judge which results are truly relevant, then requests the full text as Markdown only for the selected links.

    The benefits are structural: the full text of irrelevant pages never enters the context, so tokens are spent only on the few sources actually adopted; at the same time, the model’s judgment is based on cleaner input, reducing attention dilution caused by long texts interfering with each other. Compared with “stuff ten full articles into the context in one search,” the two-stage approach is more stable in both quality and cost.

    Three engineering points to watch: summaries must be long enough to support the judgment, since overly short ones lead to wrong selections; content fetching should have a count limit and a timeout; and cache the same link for a short period to avoid repeated fetching across multiple loop iterations.

    5. Pre-Integration Checklist

    Whichever path you take, the following preparation determines the final experience:

    1. Intent routing: first decide whether the request needs your own tools, and choose the built-in or standalone path accordingly, avoiding mid-way restructuring.
    2. Input cleaning: unify formats and size limits before file parsing, compress images before recognition, and normalize sampling and duration for audio.
    3. Context budget: set quotas and trimming policies for search results, full text, and conversation history, and keep the citation source fields.
    4. Idempotency and caching: cache parsing and fetching results keyed by content digest to prevent duplicate billing and duplicate processing.
    5. Observability: log the tool call chain, the length of each content segment, and the latency of every request, and use logging services plus monitoring alerts to locate anomalies.
    6. Fallback strategy: fall back to a local implementation or return “no latest information” when server-side capabilities are unavailable, so the conversation is not interrupted.
    7. Compliance and citation: keep source attribution for external content, and redact sensitive data before upload.

    6. Conclusion

    The choice does not depend on how long the capability list is, but on where the tool executes and whether you need to use your own tools in the same request. Leave pure conversation enhancement to built-in tools for the shortest integration path; use standalone APIs for agent orchestration, and keep the token budget in your own hands with two-stage content fetching. Once you have thought through the execution location, the request structure constraint, and the preparation checklist, the cost of integrating the wrong entry point is largely eliminated.