Server-Side Tool Integration for LLMs: A Practical Guide

    This guide explains how LLM platforms are moving tool execution to the server side, letting models decide when and how often to call tools such as web search, URL reading, document and image parsing, speech transcription, and speech synthesis. It covers how to pass process blocks back across turns, protocol compatibility, why sampling parameters may be ignored, how to choose document parsing modes to control cost, and a deployment checklist for integrating these capabilities without rewriting business logic.

    1. The Shift: From Client-Side Pipelines to Server-Managed Tools

    Until recently, building a web-enabled Q&A assistant in your own application meant owning the entire pipeline: calling a search API for candidate pages, fetching and cleaning the text, chunking and truncating it, assembling snippets into the context, and handling citation numbering and source display. Very little of that chain was related to model capability; most of it was engineering grunt work, and it was easily disrupted by page structure changes, anti-scraping measures, timeouts, and retries. Stability and user experience were hard to guarantee.

    The recent industry change is that model providers have started executing these tools on the server side. Capabilities such as web search, reverse image search, reading a specified URL, document and image parsing, speech transcription, and speech synthesis are packaged as tools that can be enabled through request parameters. The model decides on its own when and how many times to call them, and returns the conclusion together with source citations. For developers, the architectural focus shifts from “how do I feed the model the right material” to “how do I declare available tools and correctly pass process data back.”

    One boundary needs to be clear up front: server-side tools usually become available on lightweight or specific model versions first, while more capable flagship versions often follow later. Version abstraction should therefore be part of the design from the start, so tool availability is not hard-coded into business logic.

    Once the server takes over retrieval, the interaction changes in two substantive ways.

    First, retrieval is model-driven. The request only describes the question and the available tools; whether to search, how many rounds to search, and how to rewrite queries are all decided by the model. With deep thinking disabled, the model performs a single web search or reverse image search as needed and answers with citations. With deep thinking enabled, retrieval is interleaved between reasoning steps, forming an iterative process: a rough search, opening authoritative pages to extract data, in-page keyword follow-ups, and re-querying with different terms when necessary. There is a cap on tool calls (commonly on the order of a dozen in the industry), and once it is reached the model must converge and answer.

    Second, process data becomes part of the context. The reasoning blocks, search result blocks, and page fetch result blocks returned by the server must be passed back unchanged in the next request. This is the most easily overlooked and most damaging constraint: if an intermediate gateway, proxy, or log-masking layer filters these blocks out, the request still returns a success status, but the model “loses its memory.” It cannot see the pages it read in the previous turn, so it searches repeatedly, contradicts itself, or fabricates answers.

    A schematic request structure (pseudocode, showing field relationships only):

    1. {
    2. "model": "<model identifier with server-managed tools available>",
    3. "messages": [
    4. { "role": "user", "content": "Compare the elevation difference between two tall towers" }
    5. ],
    6. "tools": ["web_search", "read_url"],
    7. "reasoning": { "enabled": true },
    8. "stream": true
    9. }

    On the next turn, all process blocks from the previous assistant message must be preserved:

    1. {
    2. "messages": [
    3. { "role": "user", "content": "Compare the elevation difference between two tall towers" },
    4. {
    5. "role": "assistant",
    6. "content": [
    7. { "type": "reasoning", "text": "..." },
    8. { "type": "tool_result", "name": "web_search", "text": "...citation 1..." },
    9. { "type": "text", "text": "Preliminary conclusion..." }
    10. ]
    11. },
    12. { "role": "user", "content": "Confirm the year of the data source" }
    13. ]
    14. }

    Engineering recommendation: treat process blocks as immutable data. Pass them through in full, store and audit them only, and do not process them semantically. If masking is required, handle it at the presentation layer rather than the transport layer.

    3. Protocol Compatibility and Integration Cost

    To lower migration costs, the common approach is to support multiple widely used message protocol formats, including a chat-completion-oriented protocol, a stateful response-object-oriented protocol, and a structured messages protocol. Developers usually do not need to rewrite business code; changing the base URL and model identifier is enough to get it running.

    The real investment goes into three things:

    • Tool declaration and least privilege: enable only the tools the business actually needs, so the model does not make unlimited outbound calls.
    • Timeout and retry strategy: multi-round server-side tool calls take far longer than pure generation, so streaming output must be paired with heartbeats and a time-to-first-byte timeout.
    • Observability: log tool call counts per turn, hit source domains, and truncation, to support later optimization of prompts and retrieval quality.

    4. Watch Out for Ignored Sampling Parameters

    When tool calls, automatic title generation, or a higher safety level are enabled in a request, the server takes over the sampling schedule, and explicitly passed parameters such as temperature, top-p (nucleus sampling ratio), frequency and presence penalties, and stop sequences are ignored. This means the traditional tuning experience of “lowering temperature for stability” no longer applies in these scenarios. Output stability must instead be ensured through prompt constraints, structured output, and post-processing validation.

    There are two ways around this: first, for subtasks that need fine control over generation style, use a separate call without tools; second, put controllability in the prompt and validation layers, for example by requiring the model to output a structured conclusion before generating natural language, and by checking citation numbers for consistency.

    5. Document and Image Parsing: Cost Control Starts with Mode Selection

    Per-page parsing objects typically include PDF documents, word processing documents, presentations, and images, with two modes available: plain text extraction and rich parsing with layout understanding.

    Take a financial report as an example. With plain text extraction only, the revenue trend chart is discarded entirely, the model sees no graphical information, and questions about the chart can only be answered by guessing from body text numbers. With rich parsing enabled, the system attempts to crop image regions and insert them back at their original positions, giving the model the ability to read images. The cost is that cropped images are billed as image input, and chart regions rely on automatic detection, which carries a risk of missed crops; missed regions remain invisible to the model.

    The recommended balance of cost and quality:

    1. Ingest documents in plain text mode first and build a retrieval index, covering most factual Q&A.
    2. For documents that genuinely require reading images, trigger rich parsing on demand and keep only the page images hit by retrieval, avoiding full retention.
    3. Manually spot-check key documents, track the missed-crop rate, and if necessary add “chart inventory” metadata during ingestion.
    4. Cache parsing results, keyed by document content summary, to avoid repeated billing.

    6. Voice and Multimodal Pipelines

    Speech transcription and speech synthesis are also provided as server-side capabilities. The typical pattern is to send audio to the transcription endpoint to convert it to text before entering the conversation pipeline, and to send the model reply to the synthesis endpoint for output. Three engineering points matter: segmenting and concatenating long audio, silence detection and endpointing, and consistent configuration of synthesis speed and voice. If the application targets scenarios such as in-car systems or customer service, end-to-end latency should also be broken down and monitored separately for transcription, first-packet generation, and synthesis.

    7. Deployment Checklist

    • Does the model version support server-side tools, and is there a fallback path?
    • Are process blocks passed back in full, and does the gateway make destructive modifications?
    • Is the ignoring of sampling parameters documented and surfaced in the frontend?
    • Are document parsing modes tiered by scenario, and is image billing predictable?
    • Are there observability metrics for tool call counts, source quality, and parsing missed crops?

    If the application runs on Baidu AI Cloud, you can combine object storage to hold original documents and parsing artifacts, a message queue to smooth peaks and run parsing asynchronously, a container platform to host gateways and proxies, and logging and monitoring/alerting services to track tool calls and time to first byte, integrating server-side tool capabilities into your own product stably without changing business code.