AI function calling and tools let your AI assistant take actions, not just chat. On-device function calling means the model can calculate, fetch data, trigger device actions, or connect to services—all while keeping your interactions private and under your control.
What is Function Calling?
Function calling (also called tool use) is the ability for an AI model to request that a specific function be executed on your behalf. Instead of only generating text, the model understands a set of available tools and can decide to invoke them when needed.
For example: you ask MyBenAI "What's the weather tomorrow?" The model recognizes this requires data outside its knowledge, so it calls a `get_weather` function with your location and date as parameters. The function fetches the data (locally or via your internet connection), and the model reads the result and responds naturally: "It'll be sunny and 72 degrees."
The model never directly accesses the network or your device. It requests; the app executes; the result goes back. This design keeps the model in a sandbox and gives you full transparency and control over what the AI can and cannot do.
How On-Device Function Calling Works
On-device function calling follows a request-response loop:
- Model generates a tool call: You ask a question. The model processes it and decides a tool is needed. It emits a structured request: "Call calculate_loan with principal=100000, rate=0.05, years=30."
- App executes the tool: MyBenAI sees the tool call, validates it against available tools, and executes it. The calculation runs locally, or a web request happens if allowed.
- Model reads the result: The function returns a value (e.g., the monthly payment). The model reads this result and generates a natural language response for you.
- Loop repeats if needed: If answering your question requires multiple tool calls, the loop repeats. The model might calculate, then fetch data, then search—all in sequence.
The entire loop is on-device and offline (unless a tool explicitly requires network, like weather or web search).
Built-In Tools in MyBenAI
MyBenAI ships with a suite of on-device tools:
- Calculations: Math, unit conversion, currency conversion. No network needed.
- Device info: Check battery level, storage, RAM available. The model can tell you "Your phone is at 23% battery" without you checking manually.
- System actions: Set a timer, create a reminder, add an event to your calendar. These are sandboxed—the model can only call them; it can't access your calendar entries without permission.
- Web search (optional): If web search is enabled, the model can search and retrieve results. This happens with your permission; you can enable or disable it.
- Custom tools via MCP/REST: You can wire up external services using MCP (Model Context Protocol) or REST connectors. Connect to a home automation system, a personal API, or a third-party service. MyBenAI handles the secure connection.
MCP and REST Connectors
MCP (Model Context Protocol) is a standard for connecting AI to external tools. If you run a home automation system (Home Assistant, Apple HomeKit, etc.), you can expose its tools to MyBenAI via MCP. The model can then control lights, locks, or thermostats on your behalf.
REST connectors are simpler: define a URL, optional authentication, and the tool schema. MyBenAI calls the endpoint when needed. This is useful for custom APIs you control or third-party services you've approved.
All connectors run over your network. For maximum privacy, run them locally (on a home server or local network device). If you connect to a cloud service, MyBenAI adds a layer of transparency: you see which tool the model wants to call and can approve or block it.
Use Cases for Tools and Function Calling
Financial planning: "Estimate my loan payment if I borrow $500k at 4% over 30 years." The model calls the mortgage calculator tool and gives you an exact answer, not a guess.
Smart home automation: "Turn off the living room lights and set the thermostat to 68 degrees." The model calls the appropriate device control tools. Everything stays on your local network if you use a local MCP server.
Task management: "Remind me to call Mom on Friday at 2 PM." The model calls the reminder tool, and your phone creates the notification without leaving MyBenAI.
Research and synthesis: "Search for recent research on X, then summarize it." The model calls web search, retrieves results, and synthesizes them into an answer.
Integration with personal workflows: Connect MyBenAI to your personal note-taking app, email, or productivity system via custom REST tools. The model can then add notes, draft emails, or log activities on your behalf.
Security and Sandboxing
The model is sandboxed. It can only call tools you've explicitly enabled. It can't access your filesystem directly, read arbitrary files, or execute arbitrary code. Every tool call is logged (in your local network log) so you can audit what the model asked the app to do.
For critical tools (like device controls or external API calls), you can require explicit approval. The model requests; you're asked to approve; the tool executes only if you say yes. This is especially useful for high-stakes actions like deleting files or transferring money.
Comparison to Cloud AI Agents
Cloud services like ChatGPT with plugins or other AI platforms support function calling too. The difference is transparency and control. With cloud AI:
- Your requests and tool calls are logged on the provider's servers.
- You trust the provider to handle integration securely (leaks and misconfigurations are common).
- Third-party tools might see your data (depending on the integration).
With on-device MyBenAI:
- Tool calls stay on your phone. Cloud integrations only happen if you approve them.
- Local tools (calculations, reminders, device actions) are 100% private.
- You control which tools are available and when they're used.
Setting Up Tools
In MyBenAI's settings, enable the tools you need. Built-in tools are toggled on/off. MCP servers and REST connectors are added via configuration—typically a URL and optional credentials.
Once enabled, tools are available to the model in every conversation. The model learns when to use them (the model is trained on tool descriptions) and calls them automatically when relevant to your request.
Reliability and Errors
Tools fail gracefully. If a tool call fails (network error, invalid parameters, service down), the error is returned to the model as a result. The model then either retries, uses a fallback, or tells you the tool didn't work. This is different from cloud systems where tool failures sometimes crash the entire conversation.
For critical use cases, you can set tool timeouts and retry policies. The model won't wait forever for a slow external service; it'll give up and move on.
Privacy and Logging
Every tool call—what was requested, what the result was—is logged to your local `network_log` table in the database. You can review this log anytime in the app's privacy dashboard. This transparency is fundamental to private AI: you can see exactly what the model did on your behalf.
Beyond Chat
Tools don't just support chat. Scheduled jobs in MyBenAI can use tools too. Set up a job that runs daily: "Search the news for updates on X and add a note to my journal." The job runs locally, calls tools as needed, and never logs interactions with external services beyond what's necessary.
Ready to give your AI the power to act? Get MyBenAI and enable tools for an AI assistant that not only understands but also executes. Learn more about how sub-agents parallelize tool use for faster research, or explore the full scope of on-device AI capabilities. For understanding long-term task execution, check out our guide on persistent memory and task continuity.