@segmentstream/ontology 0.202.0 → 0.202.1
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/CHANGELOG.md +7 -0
- package/dist/service/mcp/listing.d.ts +10 -2
- package/dist/service/mcp/listing.js +19 -14
- package/dist/service/mcp/server.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.202.1
|
|
4
|
+
|
|
5
|
+
A `tools/list` cursor now survives a redeploy of the app between pages. The listing resumes after
|
|
6
|
+
the last tool it returned, or at that tool's position when the new catalog no longer has it, so MCP
|
|
7
|
+
clients no longer fail to load a workspace's tools while it is being deployed. A cursor from other
|
|
8
|
+
permissions is still refused.
|
|
9
|
+
|
|
3
10
|
## 0.202.0
|
|
4
11
|
|
|
5
12
|
A member of staff answers the chat of someone the agent never admitted. Recording a channel
|
|
@@ -19,8 +19,16 @@ export declare function toolDefinition(tool: McpTool): {
|
|
|
19
19
|
openWorldHint: boolean;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Standard MCP operation definitions; pagination never substitutes search or dispatch tools.
|
|
24
|
+
*
|
|
25
|
+
* A cursor names the last tool it listed, its position and the caller's permissions. A listing
|
|
26
|
+
* survives a redeploy of the app between pages: it resumes after that tool in the current
|
|
27
|
+
* catalog, or at its position when the tool is gone, since clients do not restart a listing whose
|
|
28
|
+
* cursor is refused. A cursor from other permissions is refused, so no page lists a tool the
|
|
29
|
+
* caller may not use.
|
|
30
|
+
*/
|
|
31
|
+
export declare function listTools(tools: ReadonlyArray<McpTool>, principal: PermissionHolder, caller: CallerContext, cursor?: unknown): {
|
|
24
32
|
tools: Array<ReturnType<typeof toolDefinition>>;
|
|
25
33
|
nextCursor?: string;
|
|
26
34
|
};
|
|
@@ -24,16 +24,19 @@ function invalidCursor() {
|
|
|
24
24
|
detail: "The tool-list cursor is invalid or the catalog or permissions changed. Restart tools/list.",
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Standard MCP operation definitions; pagination never substitutes search or dispatch tools.
|
|
29
|
+
*
|
|
30
|
+
* A cursor names the last tool it listed, its position and the caller's permissions. A listing
|
|
31
|
+
* survives a redeploy of the app between pages: it resumes after that tool in the current
|
|
32
|
+
* catalog, or at its position when the tool is gone, since clients do not restart a listing whose
|
|
33
|
+
* cursor is refused. A cursor from other permissions is refused, so no page lists a tool the
|
|
34
|
+
* caller may not use.
|
|
35
|
+
*/
|
|
36
|
+
export function listTools(tools, principal, caller, cursor) {
|
|
29
37
|
const visible = visibleTools(tools, principal, caller);
|
|
30
38
|
const scope = createHash("sha256")
|
|
31
|
-
.update(JSON.stringify([
|
|
32
|
-
hash,
|
|
33
|
-
caller.kind,
|
|
34
|
-
[...new Set(principal.permissions)].sort(),
|
|
35
|
-
visible.map(({ name }) => name),
|
|
36
|
-
]))
|
|
39
|
+
.update(JSON.stringify([caller.kind, [...new Set(principal.permissions)].sort()]))
|
|
37
40
|
.digest("hex");
|
|
38
41
|
let start = 0;
|
|
39
42
|
if (cursor !== undefined) {
|
|
@@ -51,16 +54,18 @@ export function listTools(tools, principal, caller, hash, cursor) {
|
|
|
51
54
|
decoded === null ||
|
|
52
55
|
!("scope" in decoded) ||
|
|
53
56
|
!("last" in decoded) ||
|
|
57
|
+
!("at" in decoded) ||
|
|
54
58
|
decoded.scope !== scope ||
|
|
55
|
-
typeof decoded.last !== "string"
|
|
59
|
+
typeof decoded.last !== "string" ||
|
|
60
|
+
typeof decoded.at !== "number" ||
|
|
61
|
+
!Number.isSafeInteger(decoded.at) ||
|
|
62
|
+
decoded.at < 0) {
|
|
56
63
|
return invalidCursor();
|
|
57
64
|
}
|
|
58
65
|
const last = decoded.last;
|
|
59
66
|
const position = visible.findIndex(({ name }) => name === last);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
start = position + 1;
|
|
67
|
+
// Gone from the catalog: the tool after it now holds its position.
|
|
68
|
+
start = position >= 0 ? position + 1 : Math.min(decoded.at, visible.length);
|
|
64
69
|
}
|
|
65
70
|
// Eve 0.85 calls listTools once, unlike AI SDK's tools() which follows nextCursor.
|
|
66
71
|
// Keep deployed runtime clients working; both paths expose the same direct operations.
|
|
@@ -85,7 +90,7 @@ export function listTools(tools, principal, caller, hash, cursor) {
|
|
|
85
90
|
tools: selected,
|
|
86
91
|
...(last !== undefined && start + selected.length < visible.length
|
|
87
92
|
? {
|
|
88
|
-
nextCursor: Buffer.from(JSON.stringify({ scope, last: last.name })).toString("base64url"),
|
|
93
|
+
nextCursor: Buffer.from(JSON.stringify({ scope, last: last.name, at: start + selected.length - 1 })).toString("base64url"),
|
|
89
94
|
}
|
|
90
95
|
: {}),
|
|
91
96
|
};
|
|
@@ -701,7 +701,7 @@ function dispatch(server, message, request) {
|
|
|
701
701
|
return rpcResult(id, {});
|
|
702
702
|
case "tools/list": {
|
|
703
703
|
return yield* Effect.try({
|
|
704
|
-
try: () => listTools(server.tools, principal, caller,
|
|
704
|
+
try: () => listTools(server.tools, principal, caller, params.cursor),
|
|
705
705
|
catch: (error) => error,
|
|
706
706
|
}).pipe(Effect.map((result) => rpcResult(id, result)), Effect.catchIf((error) => error instanceof DiscoveryError, (error) => Effect.succeed(rpcError(id, INVALID_PARAMS, error.detail))));
|
|
707
707
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/ontology",
|
|
3
|
-
"version": "0.202.
|
|
3
|
+
"version": "0.202.1",
|
|
4
4
|
"description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|