Preventing Hallucinations with MCP: Verify Before Writing
Ensure accuracy in MCP workflows by verifying data before using it. This accuracy guide shows you when to call tools to verify task details, how to cite sources from tool output, and how to avoid invented statuses, dates, and other hallucinated information.
What This Guide Covers
This guide teaches you to prevent hallucinations in MCP workflows:
Key Topics
- Verification patterns: When to call tools to verify data
- Citation methods: How to cite sources from tool output
- Hallucination prevention: Avoid invented statuses, dates, IDs
- Assistant checklist: Steps to ensure accuracy
- Best practices: Patterns that prevent errors
When to Verify Task Details
Before Writing Operations
Always verify task details before updating or creating:
Safe Update Pattern
What the AI does:
- Calls
get_taskto fetch current state - Shows actual task details (not assumed)
- Uses verified data for updates
- Prevents updating wrong task or using wrong status
Before Reporting
Verify data before including it in reports:
Accurate Reporting Pattern
What the AI does:
- Calls
list_tasksto get task list - For key tasks, calls
get_taskto verify details - Uses verified data in report
- Cites source: "According to task data retrieved at [time]"
Citing Sources from Tool Output
Always cite where information came from:
Citation Pattern
What the AI does:
- Calls
list_tasksto get data - Formats output with citations
- Shows: "According to Corcava task data: [details]"
- Makes source clear to user
Example: Cited Report
Report with Citations
Status Report (with citations):
According to task data retrieved from Corcava at 10:00 AM:
- Task "Implement auth" - Status: in_progress (verified via get_task)
- Task "API refactor" - Status: open (verified via get_task)
This pattern: Makes source clear, shows verification happened
Avoiding Invented Information
Common Hallucinations
⚠️ What to Avoid
- Invented statuses: Don't assume task status—always fetch it
- Made-up dates: Don't infer due dates—get them from task data
- Wrong IDs: Don't guess IDs—always list and select
- Assumed assignees: Don't assume who's assigned—verify
- Inferred progress: Don't guess completion—check actual status
Prevention Patterns
Always Verify Pattern
Benefits:
- Prevents inventing information
- Forces tool calls for data
- Makes missing data explicit
Assistant Checklist
Accuracy Checklist for Assistants
- Verify before write: Always call get_task/get_project before updating
- Cite sources: Always mention where data came from (tool call output)
- No assumptions: Never assume status, date, assignee—always fetch
- Verify IDs: Always list items to find correct IDs, don't guess
- Check timestamps: Note when data was retrieved (may be stale)
- Handle missing data: Say "not available" rather than inventing
- Double-check critical info: For important operations, verify twice
Complete Examples
Example 1: Safe Status Update
Complete Safe Update Prompt
This pattern: Verify → Show → Confirm → Update
Example 2: Accurate Status Report
Complete Accurate Report Prompt
This pattern: Verify each task → Cite sources → No assumptions
Best Practices
Hallucination Prevention Best Practices
- Always verify: Call tools to get current data before using it
- Cite sources: Always mention where information came from
- No assumptions: Never assume status, dates, or other details
- Handle missing data: Explicitly state when data is unavailable
- Verify IDs: Always list items to find correct IDs
- Double-check critical: For important operations, verify twice
- Note timestamps: Include when data was retrieved
Troubleshooting
AI Inventing Information
Symptom: AI reports statuses or dates that don't match reality
Fix:
- Explicitly require tool calls: "Call get_task to verify"
- Forbid assumptions: "Don't assume, always fetch"
- Require citations: "Cite source for all information"
Stale Data in Reports
Symptom: Report shows outdated information
Fix:
- Require fresh data: "Call get_task to get current status"
- Include timestamps: "Note when data was retrieved"
- Verify before reporting: "Verify each task before including"
Related Resources
Write Approval Patterns
Safe write operations
ID Selection
Find correct IDs
Status Reports
Accurate reporting workflows
Get Task Tool
Verify task details
Prevent Hallucinations in MCP
Use verification patterns and citations to ensure accuracy
