@seastudio/sdk 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/{chunk-TFOJLA2F.cjs → chunk-3I7UM66P.cjs} +9 -7
- package/dist/{chunk-XU5GEWWL.js → chunk-4QK6VMIM.js} +744 -822
- package/dist/{chunk-SUF5BPSK.cjs → chunk-7I3A4U6V.cjs} +752 -824
- package/dist/{chunk-EIOFZMTC.cjs → chunk-E33WZ4UI.cjs} +10 -10
- package/dist/{chunk-D7ONFXVY.js → chunk-IBRD7E5X.js} +3 -3
- package/dist/{chunk-ANWOL7SM.js → chunk-TJ3CGHWJ.js} +9 -7
- package/dist/index.cjs +49 -61
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mcp/core/index.cjs +22 -22
- package/dist/mcp/core/index.d.cts +10 -7
- package/dist/mcp/core/index.d.ts +10 -7
- package/dist/mcp/core/index.js +1 -1
- package/dist/mcp/index.cjs +49 -61
- package/dist/mcp/index.d.cts +5 -5
- package/dist/mcp/index.d.ts +5 -5
- package/dist/mcp/index.js +3 -3
- package/dist/mcp/seastudio/index.cjs +48 -24
- package/dist/mcp/seastudio/index.d.cts +87 -33
- package/dist/mcp/seastudio/index.d.ts +87 -33
- package/dist/mcp/seastudio/index.js +2 -2
- package/dist/{types-B32sUvc0.d.cts → types-CUFTi2bZ.d.cts} +1 -0
- package/dist/{types-B32sUvc0.d.ts → types-CUFTi2bZ.d.ts} +1 -0
- package/package.json +1 -1
- package/src/develop-tool/templates/plugin/frontend/package.json.tmpl +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,20 @@ await preview.get('/path/to/file');
|
|
|
68
68
|
|
|
69
69
|
说明:`@seastudio/sdk/mcp` 现在的官方稳定支持面聚焦在 raw MCP catalog、包索引和通用转换能力,不包含额外的上层适配逻辑。
|
|
70
70
|
|
|
71
|
+
### 指定插件实例调用 Tool
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { callHostTool } from '@seastudio/sdk';
|
|
75
|
+
|
|
76
|
+
await callHostTool(
|
|
77
|
+
'plugin-editor_open_file',
|
|
78
|
+
{ path: '/tmp/demo.ts' },
|
|
79
|
+
{ pluginInstanceId: 'plugin-123' }
|
|
80
|
+
);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`pluginInstanceId` 是 `tools/call` 的可选协议字段,用于在同一插件存在多个实例时精确路由到目标实例。宿主在已知上下文时也可以自动补齐这个字段,因此大多数常规调用不需要手动传入。
|
|
84
|
+
|
|
71
85
|
### 动态加载插件 MCP
|
|
72
86
|
|
|
73
87
|
```typescript
|
|
@@ -294,10 +294,12 @@ var MCPClient = class {
|
|
|
294
294
|
return this.timeout;
|
|
295
295
|
}
|
|
296
296
|
async callTool(name, args = {}, options) {
|
|
297
|
-
|
|
297
|
+
const request = {
|
|
298
298
|
name,
|
|
299
|
-
arguments: args
|
|
300
|
-
|
|
299
|
+
arguments: args,
|
|
300
|
+
...typeof options?.pluginInstanceId === "string" && options.pluginInstanceId.trim() ? { pluginInstanceId: options.pluginInstanceId.trim() } : {}
|
|
301
|
+
};
|
|
302
|
+
return this.request("tools/call", request, {
|
|
301
303
|
timeout: this.resolveToolCallTimeout(name, args, options)
|
|
302
304
|
});
|
|
303
305
|
}
|
|
@@ -379,11 +381,11 @@ function getDefaultClient() {
|
|
|
379
381
|
function setDefaultClient(client) {
|
|
380
382
|
defaultClient = client;
|
|
381
383
|
}
|
|
382
|
-
async function callHostTool(toolName, args = {}) {
|
|
383
|
-
return getDefaultClient().callTool(toolName, args);
|
|
384
|
+
async function callHostTool(toolName, args = {}, options) {
|
|
385
|
+
return getDefaultClient().callTool(toolName, args, options);
|
|
384
386
|
}
|
|
385
|
-
async function callHostToolText(toolName, args = {}) {
|
|
386
|
-
return getDefaultClient().callToolText(toolName, args);
|
|
387
|
+
async function callHostToolText(toolName, args = {}, options) {
|
|
388
|
+
return getDefaultClient().callToolText(toolName, args, options);
|
|
387
389
|
}
|
|
388
390
|
|
|
389
391
|
// src/mcp/core/server.ts
|