@canonmsg/agent-tools 0.2.1 → 0.3.0
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/dist/verb-tools.js +11 -0
- package/package.json +3 -3
package/dist/verb-tools.js
CHANGED
|
@@ -76,11 +76,20 @@ const INTERACTION_POSTURE_NOTES = {
|
|
|
76
76
|
};
|
|
77
77
|
export const CANON_TOOL_VERBS = Object.keys(CANON_VERB_TOOL_DESCRIPTIONS);
|
|
78
78
|
const CARD_VERBS = new Set(['send_card', 'request_card']);
|
|
79
|
+
const RUNTIME_OWNED_TOOL_FIELDS = ['native', 'runtimeId', 'turnId'];
|
|
79
80
|
/** MCP tool definitions projected from the contract, shaped per binding. */
|
|
80
81
|
export function canonVerbToolDefinitions(options = {}) {
|
|
81
82
|
const interaction = options.interaction ?? 'notify';
|
|
82
83
|
return CANON_TOOL_VERBS.map((verb) => {
|
|
83
84
|
let inputSchema = getVerbInputSchema(verb, CARD_VERBS.has(verb) ? { cardSchema: RUNTIME_CARD_JSON_SCHEMA_V1 } : undefined);
|
|
85
|
+
if (isInteractionVerb(verb)) {
|
|
86
|
+
const properties = {
|
|
87
|
+
...(inputSchema.properties ?? {}),
|
|
88
|
+
};
|
|
89
|
+
for (const field of RUNTIME_OWNED_TOOL_FIELDS)
|
|
90
|
+
delete properties[field];
|
|
91
|
+
inputSchema = { ...inputSchema, properties };
|
|
92
|
+
}
|
|
84
93
|
// The contract marks conversationId optional because bindings default it
|
|
85
94
|
// to the active conversation — a projection without one must require it
|
|
86
95
|
// from the model instead. Context-bound fields are either injected by
|
|
@@ -161,6 +170,8 @@ export function normalizeVerbToolArgs(verb, args, context, now = Date.now()) {
|
|
|
161
170
|
if (!INTERACTION_VERBS.has(verb))
|
|
162
171
|
return { args };
|
|
163
172
|
const completed = { ...args };
|
|
173
|
+
for (const field of RUNTIME_OWNED_TOOL_FIELDS)
|
|
174
|
+
delete completed[field];
|
|
164
175
|
if (typeof completed.conversationId !== 'string' || !completed.conversationId) {
|
|
165
176
|
if (typeof context?.conversationId === 'string' && context.conversationId) {
|
|
166
177
|
completed.conversationId = context.conversationId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/agent-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Canonical Canon verb tools — shared projections of canon.verbs.v1 for runtime bindings",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@canonmsg/core": "^
|
|
44
|
-
"@canonmsg/rich-cards": "^0.8.
|
|
43
|
+
"@canonmsg/core": "^7.0.0",
|
|
44
|
+
"@canonmsg/rich-cards": "^0.8.4",
|
|
45
45
|
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|