工作流与插件集成:关键实现点与MCP+Agent决策能力
前面我们已经把插件节点怎么跑讲清楚了。现在插件能力也讲清楚了,这篇我们把实现里那些容易被忽略但很关键的点拎出来过一遍。二期中的 MCP+Agent 决策能力,也要很大程度依赖插件。
1.插件节点的设计
在工作流里,插件节点负责把一次外部工具调用跑通。它关心两件事,第一件事是怎么定位到要调用的工具,第二件事是怎么把工作流里的输入拼成工具能懂的请求,再把工具的输出回写到工作流上下文。
1.1 节点配置 Schema
下面这个插件节点,核心信息都放在 nodeParam 里,工作流执行到这里的时候,就靠这些字段去找到插件、准备鉴权信息,并且把需要的业务入参从上下文里取出来。
{
"data": {
"inputs": [],
"nodeMeta": {
"nodeType": "工具",
"aliasName": "今日诗词_1"
},
"nodeParam": {
"appId": "f740451b",
"code": "",
"pluginId": "tool@718dbda04bc",
"operationId": "今日诗词-DNgYREVJ",
"toolDescription": "今日诗词",
"version": "V2.0",
"uid": "admin",
"businessInput": [],
"apiKey": "ebaf9dad(useyouapikey)7a87934",
"apiSecret": "ZGE0YjQ(useyouapikey)DEwYzI0M2Q1"
},
"outputs": [
{
"id": "c7f59479-d235-42a7-98ca-aca57949c641",
"name": "status",
"schema": {
"type": "string"
}
},
{
"id": "5c2fe98b-2c68-4d49-afed-cb31962b1e14",
"name": "data",
"schema": {
"properties": {
"popularity": {
"type": "integer"
},
"origin": {
"properties": {
"dynasty": {
"type": "string"
},
"author": {
"type": "string"
},
"title": {
"type": "string"
},
"content": {
"items": {
"type": "string"
},
"type": "array"
},
"translate": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"cacheAt": {
"type": "string"
},
"matchTags": {
"items": {
"type": "string"
},
"type": "array"
},
"recommendedReason": {
"type": "string"
},
"id": {
"type": "string"
},
"content": {
"type": "string"
}
},
"type": "object"
}
},
{
"id": "48bdc925-15b3-4105-a6a5-1c4186b52cc9",
"name": "token",
"schema": {
"type": "string"
}
},
{
"id": "bd135af0-8460-44b1-bf0a-6fe052f6c52f",
"name": "ipAddress",
"schema": {
"type": "string"
}
},
{
"id": "3be7c3c5-aca0-4109-b61d-51c86019fbc9",
"name": "warning",
"schema": {
"type": "string"
}
}
]
},
"id": "plugin::93252f74-3622-4f07-aba6-7035c8c7f4fe"
}
关键参数我们说明一下:
真诚点赞 诚不我欺
回复