Tool Calling

Call any APIs/MCPs as tools from the agent with just prompting

3 min read

The Model Context Protocol (MCP) integration allows rtrvr.ai agents to connect and use external tools and services. Connect MCP servers through the Chrome Extension or website interface, and our headless agents can automatically reuse those tools when triggered via API or the web platform.

MCP servers connected through the Chrome Extension are automatically available to headless agents, enabling seamless tool sharing across your automation infrastructure.

How It Works

The MCP integration provides a unified interface for tool usage across both local (Chrome Extension) and cloud (headless) environments:

  • Connect MCP servers via Chrome Extension or website interface
  • Configure which tools to enable for your agents
  • Authentication tokens are securely stored and reused by headless agents
  • Chrome Extension can generate tools on-the-fly using API keys found on screen
  • All code execution happens in a secure Chrome Extension sandbox environment

Supported MCP Servers

Connect popular services and tools through MCP:

  • Database connectors (PostgreSQL, MySQL, MongoDB)
  • Cloud storage services (AWS S3, Google Drive, Dropbox)
  • Communication platforms (Slack, Discord, Email)
  • CRM systems (Salesforce, HubSpot, Pipedrive)
  • Analytics tools (Google Analytics, Mixpanel)
  • Custom HTTP APIs and webhooks
  • Any MCP-compatible server implementation

Authentication Management

Proper authentication management is crucial for MCP tool functionality:

Remember to refresh authentication tokens periodically as they expire. Headless agents rely on these tokens to access MCP servers.
  • Authenticate MCP servers through the Chrome Extension interface
  • Tokens are automatically synced to the cloud for headless agent use
  • Set up refresh reminders for expiring tokens
  • Monitor authentication status in the dashboard
  • Revoke access anytime from the extension settings

Dynamic Tool Generation

The Chrome Extension can intelligently generate tools based on context:

  • Automatically detect API keys visible on web pages
  • Generate appropriate tool configurations on-the-fly
  • Tools created in the extension are immediately available to headless agents
  • Support for OAuth flows and token-based authentication
  • Intelligent parameter inference from API documentation

Secure Execution Environment

All tool code execution happens in a secure, sandboxed environment:

javascript
// Code runs in Chrome Extension sandbox
// Learn more: https://developer.chrome.com/docs/extensions/how-to/security/sandboxing-eval

// Example: Safe execution in sandbox
const result = await executeInSandbox({
  code: userProvidedCode,
  timeout: 30000,
  context: { /* safe context variables */ }
});
  • Isolated execution environment prevents access to sensitive browser APIs
  • Memory and CPU limits prevent resource exhaustion
  • Automatic timeout protection for long-running operations
  • Context isolation between different tool executions
  • Full audit logging of all tool invocations

Configuration Example

Configure tools through the dashboard or programmatically:

json
{
  "mcp_servers": [
    {
      "name": "company_database",
      "type": "postgresql",
      "config": {
        "connection_string": "postgresql://...",
        "allowed_operations": ["SELECT"],
        "max_rows": 1000
      }
    },
    {
      "name": "slack_workspace",
      "type": "slack",
      "config": {
        "oauth_token": "xoxb-...",
        "default_channel": "#automation",
        "allowed_actions": ["read", "post"]
      }
    },
    {
      "name": "custom_api",
      "type": "http",
      "config": {
        "base_url": "https://api.company.com",
        "auth_header": "Bearer ...",
        "rate_limit": 100
      }
    }
  ]
}

Using Tools in Workflows

Reference tools naturally in your automation prompts:

text
"Check our PostgreSQL database for customers in California, then send a Slack message with the count"

"Pull data from our Google Analytics, format it nicely, and save to Google Sheets"

"Query Salesforce for recent leads, enrich with web data, and update the CRM records"

The agent automatically:

  • Identifies which tools are needed
  • Authenticates using stored credentials
  • Executes tools in the correct sequence
  • Handles errors and retries gracefully
  • Returns structured results

Best Practices

  • Test MCP connections in the Chrome Extension before using in production
  • Set appropriate rate limits to avoid overwhelming external services
  • Use read-only permissions where possible for safety
  • Regularly audit and rotate authentication tokens
  • Monitor tool usage and costs through the dashboard
  • Document custom tool configurations for team members
Tools work seamlessly with all rtrvr.ai features including Sheets workflows, schedules, and API automation.

Ready to automate?

Join teams using rtrvr.ai to build playful, powerful web automation workflows.