MCP Integration Usage Guide
Overview
Use the MCP integration plugin to discover and execute tools provided by external MCP servers. This skill enables you to access legal databases, query APIs, search databases, and integrate with any service that provides an MCP interface.
The plugin provides a unified mcp tool with two actions:
- -
list - Discover available tools from all connected servers - INLINECODE2 - Execute a specific tool with parameters
Process
🔍 Phase 1: Tool Discovery
1.1 Check Available Tools
Always start by listing available tools to see what MCP servers are connected and what capabilities they provide.
Action:
CODEBLOCK0
Response structure:
CODEBLOCK1
1.2 Understand Tool Schemas
For each tool, examine:
- - id: Format is
"server:toolname" - split on : to get server and tool names - description: Understand what the tool does
- inputSchema: JSON Schema defining parameters
-
properties: Available parameters with types and descriptions
-
required: Array of mandatory parameter names
1.3 Match Tools to User Requests
Common tool naming patterns:
- -
search_* - Find or search operations (e.g., search_statute, search_users) - INLINECODE10 - Retrieve specific data (e.g.,
get_statute_full_text, get_weather) - INLINECODE13 - Execute queries (e.g.,
database:query) - INLINECODE15 - Analysis operations (e.g.,
analyze_law) - INLINECODE17 - Resolve references (e.g.,
resolve_citation)
🎯 Phase 2: Tool Execution
2.1 Validate Parameters
Before calling a tool:
- 1. Identify all required parameters from INLINECODE19
- Verify parameter types match schema (string, number, boolean, array, object)
- Check for constraints (minimum, maximum, enum values, patterns)
- Ensure you have necessary information from the user
2.2 Construct Tool Call
Action:
CODEBLOCK2
Example - Korean legal search:
CODEBLOCK3
2.3 Parse Response
Tool responses follow this structure:
CODEBLOCK4
For JSON responses:
const data = JSON.parse(response.content[0].text);
// Access data.result, data.results, or direct properties
🔄 Phase 3: Multi-Step Workflows
3.1 Chain Tool Calls
For complex requests, execute multiple tools in sequence:
Example - Legal research workflow:
- 1. Search -
search_statute to find relevant laws - Retrieve -
get_statute_full_text for complete text - Analyze -
analyze_law for interpretation - Precedents -
search_case_law for related cases
Each step uses output from the previous step to inform the next call.
3.2 Maintain Context
Between tool calls:
- - Extract relevant information from each response
- Use extracted data as parameters for subsequent calls
- Build up understanding progressively
- Present synthesized results to user
⚠ Phase 4: Error Handling
4.1 Common Errors
"Tool not found: server:toolname"
- - Cause: Server not connected or tool doesn't exist
- Solution: Run
action: "list" to verify available tools - Check spelling of server and tool names
"Invalid arguments for tool"
- - Cause: Missing required parameter or wrong type
- Solution: Review
inputSchema from list response - Ensure all required parameters provided with correct types
"Server connection failed"
- - Cause: MCP server not running or unreachable
- Solution: Inform user service is temporarily unavailable
- Suggest alternatives if possible
4.2 Error Response Format
Errors return:
CODEBLOCK6
Handle gracefully:
- - Explain what went wrong clearly
- Don't expose technical implementation details
- Suggest next steps or alternatives
- Don't retry excessively
Complete Example
User Request: "Find Korean laws about overtime pay"
Step 1: Discover tools
CODEBLOCK7
Response shows kr-legal:search_statute with:
- - Required:
query (string) - Optional:
limit (number), category (string)
Step 2: Execute search
CODEBLOCK8
Step 3: Parse and present
CODEBLOCK9
User-facing response:
Found 5 Korean statutes about overtime pay:
1. 근로기준법 제56조 (연장·야간 및 휴일 근로)
- Overtime work requires 50% premium
2. 근로기준법 제50조 (근로시간)
- Standard working hours: 40 hours per week
Would you like me to retrieve the full text of any statute?
Quick Reference
List Tools
CODEBLOCK11
Call Tool
CODEBLOCK12
Essential Patterns
Tool ID parsing: "server:toolname" → split on : for server and tool names
Parameter validation: Check inputSchema.required and INLINECODE33
Response parsing: JSON.parse(response.content[0].text) for JSON responses
Error detection: Check response.isError === true
Reference Documentation
Core Documentation
Usage Examples
- - Examples Collection: EXAMPLES.md - 13 real-world examples including:
- Legal research workflows
- Database queries
- Weather service integration
- Multi-step complex workflows
- Error handling patterns
Remember: Always start with
action: "list" when uncertain about available tools.
MCP 集成使用指南
概述
使用 MCP 集成插件来发现并执行外部 MCP 服务器提供的工具。此技能使您能够访问法律数据库、查询 API、搜索数据库,并与任何提供 MCP 接口的服务进行集成。
该插件提供了一个统一的 mcp 工具,包含两个操作:
- - list - 发现所有已连接服务器提供的可用工具
- call - 使用参数执行特定工具
流程
🔍 阶段一:工具发现
1.1 检查可用工具
始终从列出可用工具开始,以查看哪些 MCP 服务器已连接以及它们提供哪些功能。
操作:
{
tool: mcp,
args: {
action: list
}
}
响应结构:
json
[
{
id: server:toolname,
server: server-name,
name: tool-name,
description: 该工具的功能说明,
inputSchema: {
type: object,
properties: {...},
required: [...]
}
}
]
1.2 理解工具模式
对于每个工具,检查:
- - id:格式为 server:toolname - 以 : 分割获取服务器和工具名称
- description:理解工具的功能
- inputSchema:定义参数的 JSON Schema
- properties:可用参数及其类型和描述
- required:必填参数名称数组
1.3 将工具与用户请求匹配
常见工具命名模式:
- - search - 查找或搜索操作(例如 searchstatute、searchusers)
- get - 检索特定数据(例如 getstatutefulltext、getweather)
- query - 执行查询(例如 database:query)
- analyze - 分析操作(例如 analyzelaw)
- resolve - 解析引用(例如 resolvecitation)
🎯 阶段二:工具执行
2.1 验证参数
在调用工具之前:
- 1. 从 inputSchema.required 中识别所有必填参数
- 验证参数类型与模式匹配(字符串、数字、布尔值、数组、对象)
- 检查约束条件(最小值、最大值、枚举值、模式)
- 确保您拥有用户提供的必要信息
2.2 构建工具调用
操作:
{
tool: mcp,
args: {
action: call,
server: ,
tool: ,
args: {
// 来自 inputSchema 的工具特定参数
}
}
}
示例 - 韩国法律搜索:
{
tool: mcp,
args: {
action: call,
server: kr-legal,
tool: search_statute,
args: {
query: 연장근로 수당,
limit: 5
}
}
}
2.3 解析响应
工具响应遵循以下结构:
json
{
content: [
{
type: text,
text: JSON 字符串或文本结果
}
],
isError: false
}
对于 JSON 响应:
javascript
const data = JSON.parse(response.content[0].text);
// 访问 data.result、data.results 或直接属性
🔄 阶段三:多步骤工作流
3.1 链式工具调用
对于复杂请求,按顺序执行多个工具:
示例 - 法律研究工作流:
- 1. 搜索 - searchstatute 查找相关法律
- 检索 - getstatutefulltext 获取完整文本
- 分析 - analyzelaw 进行解释
- 判例 - searchcase_law 查找相关案例
每个步骤使用上一步的输出为下一步调用提供信息。
3.2 保持上下文
在工具调用之间:
- - 从每个响应中提取相关信息
- 将提取的数据用作后续调用的参数
- 逐步建立理解
- 向用户呈现综合结果
⚠ 阶段四:错误处理
4.1 常见错误
Tool not found: server:toolname
- - 原因:服务器未连接或工具不存在
- 解决方案:运行 action: list 验证可用工具
- 检查服务器和工具名称的拼写
Invalid arguments for tool
- - 原因:缺少必填参数或类型错误
- 解决方案:查看列表响应中的 inputSchema
- 确保所有必填参数以正确类型提供
Server connection failed
- - 原因:MCP 服务器未运行或无法访问
- 解决方案:告知用户服务暂时不可用
- 如果可能,建议替代方案
4.2 错误响应格式
错误返回:
json
{
content: [{type: text, text: Error: message}],
isError: true
}
优雅处理:
- - 清晰地解释出错原因
- 不暴露技术实现细节
- 建议后续步骤或替代方案
- 不要过度重试
完整示例
用户请求:查找关于加班费的韩国法律
步骤 1:发现工具
{tool: mcp, args: {action: list}}
响应显示 kr-legal:search_statute,包含:
- - 必填:query(字符串)
- 可选:limit(数字)、category(字符串)
步骤 2:执行搜索
{
tool: mcp,
args: {
action: call,
server: kr-legal,
tool: search_statute,
args: {
query: 연장근로 수당,
category: 노동법,
limit: 5
}
}
}
步骤 3:解析并呈现
javascript
const data = JSON.parse(response.content[0].text);
// 向用户呈现 data.results
面向用户的响应:
找到 5 条关于加班费的韩国法律:
- 1. 근로기준법 제56조 (연장·야간 및 휴일 근로)
- 加班工作需支付 50% 的额外工资
- 2. 근로기준법 제50조 (근로시간)
- 标准工作时间:每周 40 小时
是否需要我检索任何法律的完整文本?
快速参考
列出工具
{tool: mcp, args: {action: list}}
调用工具
{
tool: mcp,
args: {
action: call,
server: server-name,
tool: tool-name,
args: {param1: value1}
}
}
基本模式
工具 ID 解析: server:toolname → 以 : 分割获取服务器和工具名称
参数验证: 检查 inputSchema.required 和 inputSchema.properties[param].type
响应解析: 对于 JSON 响应使用 JSON.parse(response.content[0].text)
错误检测: 检查 response.isError === true
参考文档
核心文档
使用示例
- 法律研究工作流
- 数据库查询
- 天气服务集成
- 多步骤复杂工作流
- 错误处理模式
请记住: 当不确定可用工具时,始终从 action: list 开始。