Skip to main content
Model Context Protocol (MCP) servers provide tools that enable Agentic Loops to access real-world data instead of hallucinating responses. This is the key to grounding AI in verifiable facts.

Why Tools Eliminate Hallucinations

The Problem: LLMs Guess When They Don’t Know

The Solution: Tools Provide Real Data

Tools transform your agent from a text generator into a data-driven assistant:
  • No Tool: Agent guesses based on outdated training data
  • With Tool: Agent fetches current, verifiable information
Every tool call is logged, making every fact in your agent’s response traceable to its source. This builds trust and enables debugging.

Available MCP Servers

Built-In MCP Servers

These servers are ready to use without additional setup:

Time Utilities

Current time, date utilities, timezone conversion

OpenRouter

AI model recommendations and capabilities

Conversation Archives

Access conversation history and summaries

Reminders

Create and manage reminders for conversations

External Data Source MCP Servers

These require API keys from external services:

Google Maps

Geocoding, place search, directions, location services

Custom MCP Servers

Build your own MCP servers for proprietary data sources:

Build Custom MCP Servers

Learn how to create custom MCP servers using Laravel’s MCP package

Configuring MCP Servers

1

Open Agent Loop Settings

Navigate to your Agentic Loop configuration page.
2

Add MCP Server

In the MCP Servers section, click Add Server.
MCP server configured

MCP server configuration

3

Select Server Type

Choose from available MCP servers:
  • Time Utilities: No additional config required
  • Google Maps: Requires Google Maps API key
  • Custom Server: Enter your server URL
4

Configure Authentication

For servers requiring API keys:
5

Test Connection

Click Test to verify the MCP server is accessible.
6

Save

Click Save to enable the tool for your agent.

Using MCP Tools in Your Agent

1. Document Tools in System Prompt

The agent needs to know what tools are available and when to use them. Example System Prompt:

2. Agent Decides When to Use Tools

During execution, the agent analyzes the user’s question and determines which tool to use:

3. Multiple Tool Calls

Complex queries may require multiple tool calls:

Real-World Examples by Use Case

Example 1: Order Tracking System

Goal: Stop hallucinating order statuses. MCP Server Configuration:
System Prompt:
Result: 100% accurate order information, zero hallucinations.

Example 2: Weather Information Bot

Goal: Provide current weather, not outdated training data. MCP Server Configuration:
System Prompt:
Result: Always current weather data, no outdated information.

Example 3: Location-Based Recommendations

Goal: Recommend actual places, not fictional locations. MCP Server Configuration:
System Prompt:
Result: All recommendations are real, verified locations.

Example 4: Calendar Assistant

Goal: Schedule meetings based on actual availability. MCP Server Configuration:
System Prompt:
Result: Zero scheduling conflicts, all meetings based on real availability.

Authentication Patterns

MCP servers use different authentication methods:

Pattern 1: Public (No Authentication)

Some servers are publicly accessible:

Pattern 2: Conversation API Key

Servers accessing conversation data use the conversation’s API key:

Pattern 3: External API Key

Servers proxying external services require API keys:

Pattern 4: Custom Authentication

Your custom MCP servers can use any auth method:

Building Custom MCP Servers

Create tools for your proprietary data sources:

When to Build Custom MCP Servers

Build custom servers when you need to:
  • Access your internal databases
  • Connect to proprietary APIs
  • Implement custom business logic
  • Integrate with legacy systems
  • Provide domain-specific tools

MCP Server Requirements

Your server must:
  1. Accept tool call requests (POST /tools/)
  2. Execute the requested action
  3. Return structured JSON responses
  4. Handle errors gracefully

Example: Order Database MCP Server

Deploying Your MCP Server

1

Deploy to Production

Host your MCP server at a publicly accessible URL:
2

Document Your Tools

Create clear documentation for each tool:
3

Add to Agent Loop

Configure your custom MCP server in the agent loop:
4

Update System Prompt

Document the tools in your agent’s system prompt:

Build Custom MCP Servers

Complete guide to building MCP servers with Laravel’s MCP package

Tool Call Format

Request Format

MCP servers receive tool calls in this format:

Success Response

Error Response

Troubleshooting

Tool Not Being Called

Symptom: Agent provides answer without calling tool (hallucination). Possible Causes:
  • Tool not mentioned in system prompt
  • Instructions unclear about when to use tool
  • Agent decided tool wasn’t necessary
Solutions:

Tool Call Fails

Symptom: Error message in execution log, agent can’t complete task. Check:
  • MCP server URL is correct and accessible
  • Authentication credentials are valid
  • MCP server is running and responsive
  • Parameters match expected format
  • Network connectivity between platform and server
Debug:

Wrong Parameters Sent

Symptom: Tool receives incorrect or missing parameters. Possible Causes:
  • System prompt doesn’t document parameters clearly
  • Agent misunderstood parameter requirements
  • Parameter validation is missing
Solutions:

Tool Responses Are Inconsistent

Symptom: Sometimes works, sometimes doesn’t. Check:
  • Timeout settings (increase if needed)
  • Rate limiting on external APIs
  • Data availability (some queries may return no results)
  • Error handling in MCP server code

Best Practices

Start Simple

Begin with one tool, add more as needed

Document Clearly

Explicit tool documentation in system prompts

Test Thoroughly

Test tools separately before agent integration

Handle Errors

Provide clear error messages for debugging

System Prompt Best Practices

Do:
  • List all available tools with descriptions
  • Document parameters and return values
  • Provide usage examples
  • Specify when to use each tool
  • Include error handling instructions
Don’t:
  • Assume agent knows about tools (document everything)
  • Use vague descriptions (“use this when needed”)
  • Skip parameter documentation
  • Forget to mention required vs. optional parameters

MCP Server Design

Do:
  • Create focused, single-purpose tools
  • Use clear, descriptive tool names
  • Validate all input parameters
  • Return structured, consistent JSON
  • Include helpful error messages
Don’t:
  • Create overly complex multi-purpose tools
  • Return unstructured text responses
  • Skip input validation
  • Ignore errors or return generic “failed” messages

Next Steps

Best Practices

Optimize for performance, cost, and reliability

Available MCP Servers

Explore all built-in MCP servers

Build Custom Servers

Create tools for your proprietary systems

Complete API Reference

View the full API specification for MCP server integration