@tplog/pi-zendy 0.3.2 → 0.3.4
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/extensions/tools.ts +22 -1
- package/package.json +1 -1
package/extensions/tools.ts
CHANGED
|
@@ -48,7 +48,28 @@ function registerZendeskTools(pi: ExtensionAPI): void {
|
|
|
48
48
|
}),
|
|
49
49
|
async execute(_toolCallId: string, params: { query: string }, signal?: AbortSignal) {
|
|
50
50
|
const result = await zendesk.searchTickets(params.query, signal);
|
|
51
|
-
|
|
51
|
+
const lines = [`Zendesk search returned ${result.count} results for "${params.query}":`];
|
|
52
|
+
for (const r of result.results) {
|
|
53
|
+
const id = r.id ?? '?';
|
|
54
|
+
const subject = r.subject ?? '(no subject)';
|
|
55
|
+
const status = r.status ?? '?';
|
|
56
|
+
const created = r.created_at ? String(r.created_at).slice(0, 10) : '';
|
|
57
|
+
lines.push(` #${id} [${status}] ${subject}${created ? ` (${created})` : ''}`);
|
|
58
|
+
}
|
|
59
|
+
return textResult(lines.join('\n'), { results: result.results, count: result.count });
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
pi.registerTool({
|
|
65
|
+
name: "zendy_whoami",
|
|
66
|
+
label: "Zendy Whoami",
|
|
67
|
+
description: "Check the currently authenticated Zendesk user identity. Use to verify credentials and confirm which account the tool is acting as.",
|
|
68
|
+
promptSnippet: "Check current Zendesk identity with zendy_whoami.",
|
|
69
|
+
parameters: Type.Object({}),
|
|
70
|
+
async execute(_toolCallId: string, _params: Record<string, never>, signal?: AbortSignal) {
|
|
71
|
+
const { user } = await zendesk.getMe(signal);
|
|
72
|
+
return textResult(`Authenticated as ${user.name} (${user.email}), role: ${user.role}.`, { user });
|
|
52
73
|
},
|
|
53
74
|
});
|
|
54
75
|
}
|