# Usage Examples Practical examples of using the MCP Integration plugin with OpenClaw. ## ๐Ÿ“š Table of Contents 1. [Basic Usage](#basic-usage) 2. [Legal Research](#legal-research) 3. [Database Queries](#database-queries) 4. [Weather Service](#weather-service) 5. [Multi-Step Workflows](#multi-step-workflows) 6. [Error Handling](#error-handling) ## ๐ŸŽฏ Basic Usage ### Example 1: List All Available Tools **User:** "What MCP tools do I have access to?" **OpenClaw Agent:** ``` I'll check what MCP tools are available. [Tool: mcp] Action: list ``` **Tool Call:** ```json { "tool": "mcp", "args": { "action": "list" } } ``` **Agent Response:** ``` Available MCP tools: Legal Services (kr-legal): โ€ข search_statute - Search Korean statutes and regulations โ€ข search_case_law - Search court decisions and precedents โ€ข resolve_citation - Resolve legal citations to full text Database (database): โ€ข query - Execute SQL queries โ€ข schema - Get database schema Weather (weather): โ€ข get_forecast - Get weather forecast โ€ข get_current - Get current weather conditions ``` ### Example 2: Call a Simple Tool **User:** "Get the weather for Seoul" **OpenClaw Agent:** ``` I'll check the weather in Seoul. [Tool: mcp] Action: call Server: weather Tool: get_current Arguments: {city: "Seoul"} ``` **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "weather", "tool": "get_current", "args": { "city": "Seoul" } } } ``` **Agent Response:** ``` Current weather in Seoul: โ€ข Temperature: 15ยฐC โ€ข Conditions: Partly cloudy โ€ข Humidity: 65% โ€ข Wind: 12 km/h NW ``` ## โš–๏ธ Legal Research ### Example 3: Search Korean Statutes **User:** "Find Korean laws about unfair dismissal" **Agent Workflow:** ``` I'll search Korean legal statutes for unfair dismissal. [Tool: mcp] Action: call Server: kr-legal Tool: search_statute Arguments: {query: "๋ถ€๋‹นํ•ด๊ณ ", category: "๋…ธ๋™๋ฒ•", limit: 5} ``` **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "kr-legal", "tool": "search_statute", "args": { "query": "๋ถ€๋‹นํ•ด๊ณ ", "category": "๋…ธ๋™๋ฒ•", "limit": 5 } } } ``` **Agent Response:** ``` Found 5 statutes related to unfair dismissal: 1. ๊ทผ๋กœ๊ธฐ์ค€๋ฒ• ์ œ23์กฐ (ํ•ด๊ณ  ๋“ฑ์˜ ์ œํ•œ) - Enacted: 1953-05-10 - Last amended: 2023-01-01 - Summary: ์ •๋‹นํ•œ ์ด์œ  ์—†๋Š” ํ•ด๊ณ , ํœด์ง, ์ •์ง ๋“ฑ์„ ๊ธˆ์ง€ 2. ๊ทผ๋กœ๊ธฐ์ค€๋ฒ• ์ œ26์กฐ (ํ•ด๊ณ ์˜ ์˜ˆ๊ณ ) - Summary: ํ•ด๊ณ  ์‹œ 30์ผ ์ „ ์˜ˆ๊ณ  ๋˜๋Š” 30์ผ๋ถ„ ํ†ต์ƒ์ž„๊ธˆ ์ง€๊ธ‰ 3. ๋…ธ๋™์กฐํ•ฉ ๋ฐ ๋…ธ๋™๊ด€๊ณ„์กฐ์ •๋ฒ• ์ œ81์กฐ (๋ถ€๋‹นํ•ด๊ณ  ๋“ฑ์˜ ๊ตฌ์ œ์‹ ์ฒญ) - Summary: ๋ถ€๋‹นํ•ด๊ณ  ๋“ฑ์˜ ๊ฒฝ์šฐ ๋…ธ๋™์œ„์›ํšŒ์— ๊ตฌ์ œ ์‹ ์ฒญ ๊ฐ€๋Šฅ Would you like me to get the full text of any of these statutes? ``` ### Example 4: Get Full Statute Text **User:** "Yes, show me the full text of ๊ทผ๋กœ๊ธฐ์ค€๋ฒ• ์ œ23์กฐ" **Agent Workflow:** ``` I'll retrieve the full text of ๊ทผ๋กœ๊ธฐ์ค€๋ฒ• ์ œ23์กฐ. [Tool: mcp] Action: call Server: kr-legal Tool: get_statute_full_text Arguments: {statute_id: "0065", article: 23} ``` **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "kr-legal", "tool": "get_statute_full_text", "args": { "statute_id": "0065", "article": 23 } } } ``` **Agent Response:** ``` ๊ทผ๋กœ๊ธฐ์ค€๋ฒ• ์ œ23์กฐ (ํ•ด๊ณ  ๋“ฑ์˜ ์ œํ•œ) โ‘  ์‚ฌ์šฉ์ž๋Š” ๊ทผ๋กœ์ž์—๊ฒŒ ์ •๋‹นํ•œ ์ด์œ  ์—†์ด ํ•ด๊ณ , ํœด์ง, ์ •์ง, ์ „์ง, ๊ฐ๋ด‰, ๊ทธ ๋ฐ–์˜ ์ง•๋ฒŒ์„ ํ•˜์ง€ ๋ชปํ•œ๋‹ค. โ‘ก ์‚ฌ์šฉ์ž๋Š” ๊ทผ๋กœ์ž๊ฐ€ ์—…๋ฌด์ƒ ๋ถ€์ƒ ๋˜๋Š” ์งˆ๋ณ‘์˜ ์š”์–‘์„ ์œ„ํ•˜์—ฌ ํœด์—…ํ•œ ๊ธฐ๊ฐ„๊ณผ ๊ทธ ํ›„ 30์ผ ๋™์•ˆ ๋˜๋Š” ์‚ฐ์ „ยท์‚ฐํ›„์˜ ์—ฌ์„ฑ์ด ์ด ๋ฒ•์— ๋”ฐ๋ผ ํœด์—…ํ•œ ๊ธฐ๊ฐ„๊ณผ ๊ทธ ํ›„ 30์ผ ๋™์•ˆ์€ ํ•ด๊ณ ํ•˜์ง€ ๋ชปํ•œ๋‹ค. ๋‹ค๋งŒ, ์‚ฌ์šฉ์ž๊ฐ€ ์ œ84์กฐ์— ๋”ฐ๋ผ ์ผ์‹œ๋ณด์ƒ์„ ํ•˜์˜€์„ ๊ฒฝ์šฐ ๋˜๋Š” ์‚ฌ์—…์„ ๊ณ„์†ํ•  ์ˆ˜ ์—†๊ฒŒ ๋œ ๊ฒฝ์šฐ์—๋Š” ๊ทธ๋Ÿฌํ•˜์ง€ ์•„๋‹ˆํ•˜๋‹ค. Related provisions: โ€ข ์ œ24์กฐ (๊ฒฝ์˜์ƒ ์ด์œ ์— ์˜ํ•œ ํ•ด๊ณ ์˜ ์ œํ•œ) โ€ข ์ œ26์กฐ (ํ•ด๊ณ ์˜ ์˜ˆ๊ณ ) โ€ข ์ œ27์กฐ (ํ•ด๊ณ ์‚ฌ์œ  ๋“ฑ์˜ ์„œ๋ฉดํ†ต์ง€) ``` ### Example 5: Search Case Law **User:** "Find Supreme Court cases about unfair dismissal from the last 3 years" **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "kr-legal", "tool": "search_case_law", "args": { "query": "๋ถ€๋‹นํ•ด๊ณ ", "court": "supreme", "date_from": "2021-01-01", "limit": 5 } } } ``` ## ๐Ÿ’พ Database Queries ### Example 6: Query Database **User:** "Show me the latest 10 orders from the database" **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "database", "tool": "query", "args": { "sql": "SELECT * FROM orders ORDER BY created_at DESC LIMIT 10" } } } ``` **Agent Response:** ``` Latest 10 orders: | Order ID | Customer | Amount | Status | Date | |----------|----------|---------|-----------|------------| | ORD-1234 | John Doe | $150.00 | Completed | 2026-02-01 | | ORD-1233 | Jane Doe | $89.99 | Pending | 2026-01-31 | ... ``` ### Example 7: Get Database Schema **User:** "What tables are in the database?" **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "database", "tool": "schema", "args": {} } } ``` ## ๐ŸŒฆ๏ธ Weather Service ### Example 8: Weather Forecast **User:** "What's the 7-day forecast for Tokyo?" **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "weather", "tool": "get_forecast", "args": { "city": "Tokyo", "days": 7 } } } ``` **Agent Response:** ``` 7-day forecast for Tokyo: Mon Feb 3: โ˜€๏ธ Sunny, 12ยฐC / 5ยฐC Tue Feb 4: โ›… Partly cloudy, 14ยฐC / 7ยฐC Wed Feb 5: ๐ŸŒง๏ธ Rain, 11ยฐC / 6ยฐC Thu Feb 6: โ˜๏ธ Cloudy, 10ยฐC / 4ยฐC Fri Feb 7: โ˜€๏ธ Sunny, 13ยฐC / 5ยฐC Sat Feb 8: โ›… Partly cloudy, 15ยฐC / 8ยฐC Sun Feb 9: โ˜€๏ธ Sunny, 16ยฐC / 9ยฐC ``` ## ๐Ÿ”„ Multi-Step Workflows ### Example 9: Legal Research + Analysis **User:** "Research Korean labor law about overtime pay and explain how it applies to my situation" **Agent Workflow:** **Step 1: Search statutes** ```json { "tool": "mcp", "args": { "action": "call", "server": "kr-legal", "tool": "search_statute", "args": { "query": "์—ฐ์žฅ๊ทผ๋กœ ์ˆ˜๋‹น", "category": "๋…ธ๋™๋ฒ•" } } } ``` **Step 2: Get detailed analysis** ```json { "tool": "mcp", "args": { "action": "call", "server": "kr-legal", "tool": "analyze_law", "args": { "statute_or_case": "๊ทผ๋กœ๊ธฐ์ค€๋ฒ• ์ œ56์กฐ", "analysis_type": "practical", "context": "์•ผ๊ฐ„๊ทผ๋ฌด ๋ฐ ์—ฐ์žฅ๊ทผ๋ฌด ์ˆ˜๋‹น ๊ณ„์‚ฐ" } } } ``` **Step 3: Find related cases** ```json { "tool": "mcp", "args": { "action": "call", "server": "kr-legal", "tool": "search_case_law", "args": { "query": "์—ฐ์žฅ๊ทผ๋ฌด ์ˆ˜๋‹น", "court": "supreme", "limit": 3 } } } ``` **Agent Response:** ``` Korean Labor Law on Overtime Pay - Comprehensive Analysis Legal Basis: ๊ทผ๋กœ๊ธฐ์ค€๋ฒ• ์ œ56์กฐ (์—ฐ์žฅยท์•ผ๊ฐ„ ๋ฐ ํœด์ผ ๊ทผ๋กœ) Key Points: 1. Overtime (beyond 40 hrs/week): +50% premium 2. Night work (10PM-6AM): +50% premium 3. Holiday work: +50% premium 4. Overlapping premiums stack (e.g., night + overtime = +100%) Your Situation: [Analysis based on context provided...] Relevant Precedents: 1. Supreme Court 2019๋‹ค67890 - Overtime pay calculation 2. Supreme Court 2018da54321 - Night work premium requirements 3. Supreme Court 2020da12345 - Combined premium application Next Steps: [Actionable advice based on analysis...] ``` ### Example 10: Database + Weather Integration **User:** "Check if we have any outdoor events scheduled when it's going to rain" **Step 1: Query events** ```json { "tool": "mcp", "args": { "action": "call", "server": "database", "tool": "query", "args": { "sql": "SELECT event_name, location, event_date FROM events WHERE location_type = 'outdoor' AND event_date >= CURRENT_DATE ORDER BY event_date" } } } ``` **Step 2: Check weather for each date** ```json { "tool": "mcp", "args": { "action": "call", "server": "weather", "tool": "get_forecast", "args": { "city": "Seoul", "days": 14 } } } ``` **Agent Response:** ``` Outdoor Events with Rain Risk: โš ๏ธ Feb 5 - Company Picnic (Seoul Park) Forecast: 80% rain, 11ยฐC Recommendation: Consider moving indoors or rescheduling โœ… Feb 7 - Team Building (Han River) Forecast: Sunny, 13ยฐC Status: Good to proceed โš ๏ธ Feb 10 - Product Launch (Rooftop Venue) Forecast: 60% rain, 12ยฐC Recommendation: Prepare backup indoor location ``` ## โŒ Error Handling ### Example 11: Invalid Tool **User:** "Use the magic tool" **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "kr-legal", "tool": "magic_tool", "args": {} } } ``` **Response:** ```json { "content": [ { "type": "text", "text": "Error: Tool not found: kr-legal:magic_tool. Available: kr-legal:search_statute, kr-legal:search_case_law, kr-legal:resolve_citation, kr-legal:get_statute_full_text, kr-legal:analyze_law" } ], "isError": true } ``` **Agent Response:** ``` I don't have access to a "magic tool" in the kr-legal server. Available legal tools are: โ€ข search_statute - Search statutes โ€ข search_case_law - Search case law โ€ข resolve_citation - Resolve citations โ€ข get_statute_full_text - Get full statute text โ€ข analyze_law - Analyze laws What would you like me to do? ``` ### Example 12: Missing Required Parameter **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "kr-legal", "tool": "search_statute" // Missing "args" with required "query" parameter } } ``` **Response:** ```json { "content": [ { "type": "text", "text": "Error: Invalid arguments for search_statute. Required: query" } ], "isError": true } ``` ### Example 13: Server Connection Error **Tool Call:** ```json { "tool": "mcp", "args": { "action": "call", "server": "offline-server", "tool": "some_tool", "args": {} } } ``` **Response:** ```json { "content": [ { "type": "text", "text": "Error: Tool not found: offline-server:some_tool. Server may be disconnected." } ], "isError": true } ``` ## ๐Ÿ”— Related Documentation - [Main README](../README.md) - [API Reference](API.md) - [Configuration Guide](CONFIGURATION.md) --- **Tips for Using MCP Tools:** - Always start with `action=list` to see available tools - Check tool input schemas before calling - Provide all required parameters - Handle errors gracefully - Chain multiple tools for complex workflows