Giving a Voice Agent Tools with MCP: Per-Business Servers, Confirmations and Fillers

13 min read

The problem

A voice agent that can only talk is a demo. To be useful on a dental clinic's booking line, it has to look up open slots, find a patient's next appointment, and book or cancel one. Those are tool calls: the language model asks your code to run a function, waits for the answer, then speaks.

On a screen, a slow or failed tool call is a spinner or a red error box. On a phone line it is silence, or worse, the agent saying something confidently wrong. And a tool that writes data, like booking a slot, cannot be undone with a back button. So a voice agent needs a few rules that a chat app can skip:

  • tools that only read should run without asking
  • tools that write should run only after the caller says yes, out loud, once
  • slow tools need something to fill the silence
  • errors and timeouts must come out as a normal spoken sentence
  • the tool list must stay short, because every tool definition is extra text the model reads on every turn

This post shows how to set that up with the Model Context Protocol (MCP), using one MCP server per type of business. The code follows the current official docs for the MCP Python SDK (v2) and LiveKit Agents (Python), and is shown as an example. I have not run it.

MCP in one paragraph

MCP is an open protocol for giving a model access to tools and data. An MCP server is a small program that lists tools and runs them. An MCP client is the app that connects to it, here the voice agent. The spec calls tools "model-controlled": the model decides when to call them. The client asks for the list with tools/list, and calls one with tools/call. Each tool has a name, a description, a JSON Schema for its inputs, and optional annotations that hint at what it does. Part 5 of this series, cascade vs speech-to-speech vs full-duplex, explains why tool calling is easiest in a cascade agent (speech to text, LLM, text to speech), which is what this post assumes.

One MCP server per business type

Imagine you run voice agents for many small businesses: dental clinics, pharmacies, bike repair shops. Each type of business, or "vertical", needs different tools. A clinic books appointments. A pharmacy checks refill status. A bike shop checks whether a repair is ready.

The design I would start with is one MCP server per vertical, shared by every customer in that vertical:

VerticalRead-only toolsWrite tools
Dental clinicfind_open_slots, get_patient_appointmentsbook_appointment, cancel_appointment
Pharmacy refill lineget_refill_status, get_store_hoursrequest_refill
Bike repair shopget_repair_status, get_quotebook_drop_off

The voice agent stays the same for everyone. Which server it connects to, and which tools it sees, comes from the customer's configuration. Adding a new clinic means adding a config entry, not writing new code. Adding a new vertical means writing one new server.

Running each vertical server as its own process, reached over HTTP, also keeps its dependencies and crashes away from the voice agent. The MCP Python SDK serves a server over Streamable HTTP with one command, and the SDK docs say it is then reachable at http://localhost:8000/mcp:

bash
# From the MCP Python SDK docs (py.sdk.modelcontextprotocol.io, Client and Progress pages)
uv run mcp run server.py --transport streamable-http

On the agent side, LiveKit's MCP docs say URLs ending in /mcp are treated as Streamable HTTP automatically, and that if one of several MCP servers fails to connect, the error is logged and the agent still starts.

Customer data stays where it lives

A clinic already has a scheduling system. The MCP server should call that system when a tool runs, not copy the clinic's patients into your database. The server is a thin adapter: tool in, query to the clinic's system, short answer out.

Three things in the docs support this:

  • Authorization per request. The MCP spec says the tool list must not vary per connection, but it may vary by the authorization on the request, so a server can return only the tools the caller's scopes allow. LiveKit's MCPServerHTTP takes a headers argument for auth, so each customer's agent can send its own token.
  • No hidden session. The spec says MCP has no protocol-level session. If a tool needs state across calls, it should return an explicit handle (the spec's example is a basket ID), and an expired handle should come back as a tool error.
  • Context from the job, not the database. LiveKit's external data guide suggests passing things like a calendar ID and access tokens to the agent through job metadata or participant attributes.

One example project built on this pattern follows the same idea: its vertical servers read customer data in place, and when it launches a server as a local child process it passes only the environment variables that server needs, so the agent's own secrets stay in the agent process. LiveKit's MCPServerStdio takes env and cwd arguments for exactly this kind of control.

Per-customer tool toggles

Not every clinic should get every tool. A small clinic might want the agent to book but never cancel, so cancellations always reach a human. That is a tier:

TierTools enabled
Front deskfind_open_slots, get_patient_appointments, book_appointment
Fullall of the above, plus cancel_appointment

LiveKit offers two ways to filter. Server-level filtering uses allowed_tools on MCPServerHTTP, a list of names; the API reference says only tools in that list are available. Toolset-level filtering uses MCPToolset.filter_tools() with a function, called after setup; the docs warn it does not survive setup(reload=True).

Here is a sketch of building one customer's toolset. Constructor names match LiveKit's MCP docs and the Python API reference for livekit.agents.llm.mcp:

python
# Example only. Names from docs.livekit.io: agents/logic/tools/mcp and the
# livekit.agents.llm.mcp API reference (fetched 26 Nov 2026).
import os
from livekit.agents import mcp

def clinic_toolset(customer: dict) -> mcp.MCPToolset:
    return mcp.MCPToolset(
        id=f"dental-{customer['id']}",
        mcp_server=mcp.MCPServerHTTP(
            url=customer["mcp_url"],              # ends in /mcp: Streamable HTTP
            allowed_tools=customer["enabled_tools"],
            headers={"Authorization": f"Bearer {os.environ[customer['token_env']]}"},
            client_session_timeout_seconds=10,
        ),
        tool_options={
            "find_open_slots": {"report_progress": True},
            "book_appointment": {"on_duplicate": "confirm"},
        },
    )

Filtering on the agent only hides a tool from the model. I would also enforce the tier on the server, using the token, because the spec gives the server the job of access control: it says servers MUST validate inputs and implement access controls.

Read-only tools chain freely, writes need one spoken yes

MCP lets a server mark a tool's behaviour with annotations. In the Python SDK these are passed as ToolAnnotations with read_only_hint, destructive_hint, idempotent_hint and open_world_hint. The SDK docs explain that read_only_hint=True means the tool changes nothing, and that the other two describe tools that write: may it delete something, and is calling it twice the same as once. The same page warns they are hints, not security, and a client should never be relied on to honour them.

The spec says clients SHOULD ask the user to confirm sensitive operations. In a chat app that is a button. In a voice agent, the confirmation is a spoken question. The rule I would use:

  1. Read-only tools run without asking. The agent can call get_patient_appointments, then find_open_slots, then speak.
  2. Before the first write, the agent reads back exactly what it will do and waits for a clear yes: "I can book Tuesday at 10:30 with Dr. Rao. Shall I go ahead?"
  3. After that yes, it does the writes in that plan without asking again, then gives a one-line summary.
sequenceDiagram
    participant C as Caller
    participant A as Voice agent
    participant L as LLM
    participant S as Clinic MCP server
    A->>S: tools/list at session start
    S-->>A: tools allowed for this clinic
    C->>A: Can I move my cleaning to Tuesday?
    A->>L: transcript plus tool list
    L-->>A: call get_patient_appointments
    A->>S: tools/call get_patient_appointments
    S-->>A: next appointment
    A->>L: tool result
    L-->>A: call find_open_slots
    A->>S: tools/call find_open_slots
    Note over C,A: tool is slow, filler plays in a quiet pause
    A-->>C: Let me check that for you.
    S-->>A: open slots
    A->>L: tool result
    L-->>A: read the plan back first
    A-->>C: I can book Tuesday at 10:30 with Dr. Rao. Shall I go ahead?
    C->>A: Yes, go ahead.
    A->>L: caller said yes
    L-->>A: call book_appointment
    A->>S: tools/call book_appointment
    S-->>A: Booked
    A-->>C: One line summary of the booking

Sequence: two read-only lookups chain without asking, a filler covers the slow one, and the single write waits for one spoken yes.

Animation: look up, find slots, confirm, book. The reads run on their own, and the booking waits for the caller's yes.

The example project encodes this in its agent instructions: chain read-only lookups freely, get one clear yes before the first write, then do all the writes in the plan and summarise briefly. Prompts can be ignored, so I would back this with the server too. Here is a clinic server sketch, following the MCP Python SDK docs:

python
# Example only. Follows py.sdk.modelcontextprotocol.io (MCP Python SDK v2):
# Tools page (MCPServer, ToolAnnotations), Client page (ToolError),
# Progress page (Context.report_progress).
from typing import Annotated
from pydantic import Field
from mcp.server import MCPServer
from mcp.server.mcpserver import Context
from mcp.server.mcpserver.exceptions import ToolError
from mcp.types import ToolAnnotations

from clinic_system import calendar  # placeholder for the clinic's own system

mcp = MCPServer("dental-clinic")

@mcp.tool(annotations=ToolAnnotations(read_only_hint=True, open_world_hint=False))
async def find_open_slots(
    day: Annotated[str, Field(description="Date as YYYY-MM-DD.")],
    ctx: Context,
) -> str:
    """Find open appointment slots on one day. Changes nothing."""
    await ctx.report_progress(1, message="Checking the clinic calendar.")
    slots = await calendar.open_slots(day)
    if not slots:
        return f"No open slots on {day}."
    return "Open slots: " + ", ".join(s.label for s in slots[:5])

@mcp.tool(
    annotations=ToolAnnotations(
        read_only_hint=False, destructive_hint=False,
        idempotent_hint=False, open_world_hint=False,
    )
)
async def book_appointment(slot_id: str, patient_phone: str, caller_said_yes: bool) -> str:
    """Book one slot. Only call after the caller said yes to this exact day and time."""
    if not caller_said_yes:
        raise ToolError("Not booked. Read the day and time back and ask the caller to confirm.")
    booking = await calendar.book(slot_id, patient_phone)
    if booking is None:
        raise ToolError("That slot was just taken. Offer the next open slot.")
    return f"Booked {booking.label}."

The caller_said_yes argument is my own convention, not part of MCP. It forces the model to state, in the call itself, that it asked. It does not prove the caller agreed, so the transcript and server logs still matter.

One more guard from LiveKit: the on_duplicate option. LiveKit's async tools page says duplicates are detected by tool name only, and confirm sends the running call back to the model and asks it to re-call with explicit confirmation if a duplicate is really needed. For a booking tool, that helps against a double booking when the caller repeats themselves.

Filler phrases when a tool is slow

LiveKit's external data guide says to give the user feedback when an operation takes more than a few hundred milliseconds, when doing writes, and when an operation fails. LiveKit's async tools page describes two channels:

  • ctx.update(message) adds a status to the chat context. The LLM reads it and says something natural. The first update makes the tool non-blocking, so the agent can keep talking.
  • ctx.with_filler(...) in Python plays a line through session.say(), bypassing the LLM. Its parameters are source, delay (seconds of continuous session idle before it plays), interval and max_steps. The docs say fillers only play during quiet pauses, so they do not talk over the user.

For MCP tools, the bridge is report_progress. In LiveKit's MCPToolOptions, report_progress: True forwards the MCP server's progress notifications to ctx.update(), and the tool runs in the background so the agent can narrate. On the server side, the MCP Python SDK's ctx.report_progress(progress, total=None, message=None) sends those notifications, and the SDK docs say it is a no-op when the caller did not ask for progress, so you can report unconditionally. LiveKit's source only forwards progress that carries a message, so always include one.

For a function tool you write yourself on the agent side, the LiveKit subagent example shows the filler pattern:

python
# From docs.livekit.io/agents/logic/patterns/subagent-delegation (example only)
async with ctx.with_filler(
    "Still working through it.", delay=5, interval=10, max_steps=3
):
    response = await reasoner.chat(chat_ctx=reasoner_ctx).collect()

For fixed lines like "let me check that for you", LiveKit's guide also suggests pre-synthesising the audio once and replaying it from cache, which avoids text to speech delay for that phrase.

Two warnings. A filler is not a result: while the tool runs, the agent must not say the booking worked. And LiveKit's async tools page says cancellation is opt-in because writes and payments are not safe to stop part way, so I would mark only read-only tools ToolFlag.CANCELLABLE.

Timeouts and errors, spoken like a person

The MCP spec separates two kinds of failure:

KindWhat it coversWhere it shows up
Protocol errorUnknown tool, malformed request, server errorJSON-RPC error
Tool execution errorAPI failure, bad input, business logicTool result with isError: true

The spec says clients SHOULD pass tool execution errors to the model so it can correct itself, and SHOULD implement timeouts for tool calls.

The MCP Python SDK makes the second kind easy. Raise ToolError("...") and the client gets a normal result with is_error=True and your message in the content. The SDK's client docs note that any other exception reaches the client only as Error executing tool <name>, with the details kept in the server log. LiveKit's MCP source turns an error result into a ToolError carrying that text, which the LLM then sees.

So write error messages as instructions the agent can act on and say. "That slot was just taken. Offer the next open slot." is useful. A stack trace is not.

For timeouts, LiveKit's API reference lists client_session_timeout_seconds on MCPServerHTTP and MCPServerStdio with a default of 5 seconds, plus a 5 second connection timeout on MCPServerHTTP. LiveKit's own MCP example raises the session timeout to 120 for a demo tool that it says takes about 70 seconds. The right value depends on your slowest tool, and I would measure that instead of guessing. Part 8 covers how, in measuring voice agent latency.

Then tell the agent, in its instructions, what to do when a tool fails: apologise in one short sentence, say what it can do instead, and never invent the missing answer. The example project's fallback line for an unrecoverable error is "Sorry, I am having trouble on my side. Could you say that again?" If the call can reach a human, offering a transfer is better.

Keep the tool list small

Every tool definition is text the model reads before it answers. OpenAI's function calling guide says function definitions count against the context limit and are billed as input tokens. It also gives a soft suggestion to aim for fewer than 20 functions available at the start of a turn, for accuracy. More text in means more work before the first token out, and in voice that first token gates the first sound the caller hears. Part 2, where the time goes, breaks that budget down.

What helps:

  • One vertical per session. A clinic caller never needs the bike shop's tools.
  • Tiers. allowed_tools drops what the customer did not buy.
  • Short descriptions and small schemas. One sentence on what the tool does and when to call it.
  • Stable order. The MCP spec says servers SHOULD return tools in a deterministic order, which it says improves prompt cache hit rates for LLMs.
  • Small results. LiveKit's tool_result_resolver lets you transform a result before the LLM sees it; the docs' example truncates large results. The clinic server above returns at most five slots as one plain sentence, not the clinic's whole calendar as JSON.

A checklist for each new vertical

QuestionWhere it is handled
Which tools only read?ToolAnnotations(read_only_hint=True) on the server
Which tools write, and what must the caller confirm?Agent instructions, plus a server-side check
Which tiers exist?allowed_tools on the agent, access control on the server
What does each error say?ToolError messages written as speakable sentences
Which tools can be slow?report_progress on the server and in tool_options
What is the timeout?client_session_timeout_seconds, set from measured tool times
Is the list short?Under OpenAI's soft guide of 20, ideally far fewer

If the agent also answers phone calls, the transport side is covered separately in how a phone call reaches an AI voice agent. Part 9, build a voice agent with LiveKit Agents, puts these toolsets into a full agent.

New to a term used here? The series glossary defines VAD, endpointing, barge-in, full-duplex, MCP, p95 and the rest in plain language.

Sources