Examples & Tutorials
Real-world examples of using QWED-MCP for verification in different scenarios.Example 1: Financial Calculations
Scenario
You’re building an AI-powered financial advisor. Users ask for compound interest calculations, and you need to ensure the AI’s math is correct.Setup
Conversation
User: Calculate the future value of $10,000 invested at 5% annual interest, compounded monthly, for 10 years. Claude’s Process:- Calculate: FV = P(1 + r/n)^(nt) = 10000(1 + 0.05/12)^(12×10)
- Call
verify_mathto confirm:
Example 2: Legal Reasoning
Scenario
An AI legal assistant needs to verify that conclusions follow from legal premises.Conversation
User: Under contract law: If both parties agree and consideration is exchanged, a contract is formed. Alice agreed and paid Bob. Is there a valid contract? Claude’s Process:- Formalize the logic
- Call
verify_logic:
Example 3: Secure Code Review
Scenario
A developer asks AI to review their code for security issues.Conversation
User: Review this login function:- Call
verify_code:
- SQL Injection - Direct string formatting in SQL query
- Code Injection - Using
eval()for password comparison
Example 4: Research Paper Validation
Scenario
Verifying statistical claims in AI-assisted research paper review.Conversation
User: The paper claims: “If the p-value < 0.05, we reject the null hypothesis. Our p-value was 0.03. Therefore, we reject the null hypothesis.” Claude’s Process:Example 5: SQL Query Validation
Scenario
An AI data analyst generates SQL queries. You need to ensure they’re safe before execution.Conversation
User: Get all orders for user input “admin’ OR ‘1’=‘1” Claude’s Process:- Generate query
- Call
verify_sqlbefore responding:
Example 6: Integration with LangChain
Python Code
Best Practices
1. Always Verify Before Responding
2. Use Appropriate Tools
| Task | Tool |
|---|---|
| Math/calculations | verify_math |
| Logic/reasoning | verify_logic |
| Code review | verify_code |
| SQL queries | verify_sql |
3. Handle Verification Failures
When verification fails:- Acknowledge the error
- Recalculate
- Verify again
- Explain the correction to user