> ## Documentation Index
> Fetch the complete documentation index at: https://graine.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Tools

> Connect agents to external services via Model Context Protocol

## What are MCP Tools?

MCP (Model Context Protocol) Tools allow your voice agents to interact with external APIs and services during conversations. This enables real-time data access and actions.

## Available MCP Tools

Common MCP tools include:

* `get_appointment_slots` - Fetch available appointment times
* `book_appointment` - Book appointments
* `get_order_status` - Check order status
* `create_support_ticket` - Create support tickets
* `send_email` - Send emails
* `update_crm` - Update CRM records
* Custom tools - Connect to any API

## Configuration

<Steps>
  <Step title="Open Agent Configuration">
    Navigate to your agent's configuration page
  </Step>

  <Step title="Access MCP Tools">
    Click on "Integrations & Tools" → "MCP Tools"
  </Step>

  <Step title="Add MCP Server">
    Configure your MCP server: - Server alias (e.g., "tooling") - Server URL -
    Authentication (Bearer token or API key) - Transport type (HTTP or SSE)
  </Step>

  <Step title="Select Tools">
    Enter allowed tools (comma-separated): `plaintext send_template_message,
          translate_text, get_messages `
  </Step>

  <Step title="Save Configuration">
    Tools become available as `alias-tool_name`
    Example: `tooling-send_template_message`
  </Step>
</Steps>

## Tool Configuration Format

```json theme={null}
{
  "mcp_tools": [
    {
      "server_alias": "tooling",
      "server_url": "https://api.example.com/mcp",
      "auth_type": "bearer",
      "auth_token": "your_token_here",
      "transport": "http",
      "allowed_tools": ["tool1", "tool2", "tool3"]
    }
  ]
}
```

## Use Cases

### Appointment Booking

```plaintext theme={null}
Agent: "Let me check available slots for you."
→ Calls: get_appointment_slots(date="2025-01-20")
← Returns: ["10:00 AM", "2:00 PM", "4:00 PM"]
Agent: "I have slots at 10 AM, 2 PM, and 4 PM. Which works for you?"
```

### Order Tracking

```plaintext theme={null}
Agent: "Let me look up your order."
→ Calls: get_order_status(order_id="ORD123")
← Returns: {status: "shipped", tracking: "TRK456"}
Agent: "Your order has been shipped. Tracking number is TRK456."
```

### Support Ticket Creation

```plaintext theme={null}
Agent: "I'll create a support ticket for you."
→ Calls: create_support_ticket(issue="Login problem", priority="high")
← Returns: {ticket_id: "TKT789"}
Agent: "I've created ticket #TKT789. Our team will contact you soon."
```

## Best Practices

<AccordionGroup>
  <Accordion title="Start with Essential Tools">
    Don't add too many tools initially. Start with 2-3 critical tools and expand as needed.
  </Accordion>

  <Accordion title="Use Descriptive Aliases">
    Use clear server aliases like "booking" or "crm" instead of generic names.
  </Accordion>

  <Accordion title="Test Thoroughly">
    Test each tool individually before deploying to production.
  </Accordion>

  <Accordion title="Handle Errors Gracefully">
    Ensure your agent can handle API failures and provide fallback responses.
  </Accordion>

  <Accordion title="Monitor API Usage">
    Track API calls to avoid rate limits and unexpected costs.
  </Accordion>
</AccordionGroup>

## Security

* Store API keys securely
* Use HTTPS endpoints only
* Implement rate limiting
* Validate all responses
* Log API interactions

<Warning>
  Never expose API keys in agent prompts or public configurations
</Warning>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Tool Not Working">
    * Verify server URL is correct and accessible
    * Check authentication credentials
    * Ensure tool name is in allowed\_tools list
    * Test API endpoint independently
  </Accordion>

  <Accordion title="Authentication Errors">
    * Verify auth\_type matches your API (bearer vs api\_key) - Check token hasn't
      expired - Ensure token has necessary permissions
  </Accordion>

  <Accordion title="Timeout Issues">
    * Check API response time
    * Increase timeout if needed
    * Implement caching for frequently accessed data
  </Accordion>
</AccordionGroup>

## Next Steps

<Card title="WhatsApp Integration" icon="whatsapp" href="/integrations/whatsapp">
  Learn about WhatsApp tools integration
</Card>
