What Is Function Calling?
Function calling lets your AI agent execute actions during a call. Instead of just talking, your agent can:- Book appointments in your calendar
- Look up orders in your systems
- Update CRM records
- Send confirmations
- End the call gracefully when the conversation is complete
Real-Time Action
The agent invokes tools mid-conversation and uses the results in its next reply.
Natural Experience
Callers don’t notice the tool call. It feels like talking to an agent who has your systems open in front of them.
No-Code or Your Own Server
Build tools visually in the Integrations platform, or connect your own MCP server through the API.
Explicit Opt-In
Only tools you allowlist are available to the agent. Nothing attaches by default.
Built-in Tools
TopCalls provides built-in tools that are automatically available during calls.end_call
Theend_call tool allows your AI agent to gracefully end the call when the conversation is complete.
The AI uses
end_call automatically when appropriate. The agent decides when to end based on context: user says goodbye, all questions answered, or clear conversation conclusion.- User says “goodbye”, “thanks, that’s all”, etc.
- All questions have been answered
- User explicitly asks to end the call
- Conversation naturally concludes
- AI decides to end the call
- AI speaks a contextual farewell message
- Call is terminated
Custom Tools
There are two ways to give the agent custom tools.Through the Integrations Platform (No Code)
Build a flow in the Integrations platform (for example “book a callback in Google Calendar” or “send an SMS confirmation”), then select it as a tool in the campaign editor. During calls, the agent can invoke the flow and use its result in the conversation. See Integrations for the full catalog of connectable tools.Through Your Own MCP Server (API)
If you run your own tool server that speaks the Model Context Protocol, connect it per call:| Field | What it does |
|---|---|
mcp_url | Your MCP server URL. The gateway connects at call start and merges your tools into the agent’s tool list. |
mcp_token | Bearer token the gateway sends to your server. Redacted from logs. |
mcp_tool_allowlist | Names of the tools the agent may invoke. When absent or empty, no remote tools are attached. |
tool_call_timeout_ms | Per-invocation timeout (500 to 10000 ms, default 3000). |
How a Tool Call Works
1. AI Decides
During the conversation, the AI decides a tool is needed based on what the caller asked.
Error Handling
If a tool call fails or times out, the AI is told and recovers conversationally:“I’m having trouble reaching the calendar right now. Can I take your preferred time and have someone confirm it shortly?”Design your tools to return clear error messages; the AI relays the situation naturally instead of exposing raw errors to the caller.
Best Practices
Do This
- Clear names and descriptions: The AI picks tools based on their descriptions, so write them precisely
- Validate inputs: Always validate arguments on your side before acting on them
- Return structured data: Use consistent response formats
- Fast responses: Return results quickly (under 2 seconds) so the conversation stays natural
- Allowlist narrowly: Give the agent only the tools this call needs
Avoid This
- Vague descriptions: “Helper function” doesn’t help the AI decide when to use it
- Slow tools: Long tool calls create awkward silence on the line
- Too many tools: Limit to 5-10 tools per call for best results
- Secrets in prompts: Keep credentials on your server, never in instructions
Next Steps
Integrations
Build no-code tools and flows for your agent.
Making Calls
Learn how to include tools when making calls.