Recommended architecture for safe MCP tool execution in LiveKit agents

When agents call MCP tools that trigger real-world side effects (Google Calendar, Zoho updates), what’s the best way to enforce:

  • schema validation

  • permission checks

  • org-level policies

before execution?

Do LiveKit agents support a pre-call validation hook, or is wrapping MCP tools the intended approach?

That’s a good question, and I do not have any examples I can point you towards.

There is nothing built-in, but you can use the llm_node to intercept the input going to the MCP.

async def llm_node(
    self,
    chat_ctx: llm.ChatContext,
    tools: list[Any],
    model_settings: ModelSettings,
) -> AsyncGenerator[llm.ChatChunk | str, None]:
    """Log all tool-call content from the LLM (what would be sent to MCP when it's an MCP tool)."""
    async for chunk in Agent.default.llm_node(
        self, chat_ctx, tools, model_settings
    ):
        if isinstance(chunk, llm.ChatChunk) and chunk.delta and chunk.delta.tool_calls:
            for tc in chunk.delta.tool_calls:
                logger.info(
                    "LLM tool call (content sent to MCP when MCP tool): name=%r arguments=%r",
                    tc.name,
                    tc.arguments,
                )
        yield chunk