@agentvalet/mcp-server 0.3.0 → 0.3.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/dist/index.js +26 -0
- package/dist/instructions.js +4 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -184,6 +184,11 @@ const REPORT_SELF_DIAGNOSTIC_TOOL = {
|
|
|
184
184
|
required: ["severity", "message"],
|
|
185
185
|
},
|
|
186
186
|
};
|
|
187
|
+
const LIST_MY_PENDING_ACTIONS_TOOL = {
|
|
188
|
+
name: "list_my_pending_actions",
|
|
189
|
+
description: "list_my_pending_actions: Returns this agent's currently-pending approval requests AND any that completed in the last 24 hours. Use this at session start when the user mentions an earlier action, or when use_platform's long-poll timed out and the user comes back asking what happened.\nInput: None.\nReturns: { pending: [{approval_id, platform_id, scope, created_at, expires_at}], recently_completed: [{approval_id, platform_id, scope, status, executed_at, result_summary, execution_error}] }.\nAuth: Bearer agent JWT (sent automatically).",
|
|
190
|
+
inputSchema: { type: "object", properties: {} },
|
|
191
|
+
};
|
|
187
192
|
// TODO: intent_resolve tool — planned for future release
|
|
188
193
|
// ---------------------------------------------------------------------------
|
|
189
194
|
// MCP server setup
|
|
@@ -197,6 +202,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
197
202
|
AGENT_STATUS_TOOL,
|
|
198
203
|
AUTHZEN_EVALUATE_TOOL,
|
|
199
204
|
REPORT_SELF_DIAGNOSTIC_TOOL,
|
|
205
|
+
LIST_MY_PENDING_ACTIONS_TOOL,
|
|
200
206
|
],
|
|
201
207
|
}));
|
|
202
208
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -248,6 +254,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
248
254
|
}
|
|
249
255
|
return await handleAuthzenEvaluate(args.platform_id, args.scope);
|
|
250
256
|
}
|
|
257
|
+
if (name === "list_my_pending_actions") {
|
|
258
|
+
return await handleListMyPendingActions();
|
|
259
|
+
}
|
|
251
260
|
if (name === "report_self_diagnostic") {
|
|
252
261
|
if (!args || typeof args.severity !== "string" || typeof args.message !== "string") {
|
|
253
262
|
return errorContent("Invalid or missing arguments: severity and message are required");
|
|
@@ -494,6 +503,23 @@ async function handleAuthzenEvaluate(platformId, scope) {
|
|
|
494
503
|
return errorContent(`Proxy error ${response.status}: ${body}`);
|
|
495
504
|
return { content: [{ type: "text", text: body }] };
|
|
496
505
|
}
|
|
506
|
+
async function handleListMyPendingActions() {
|
|
507
|
+
if (AGENT_PRIVATE_KEY_RAW === null) {
|
|
508
|
+
await notifyBindSecret();
|
|
509
|
+
return pendingFirstCallResponse();
|
|
510
|
+
}
|
|
511
|
+
let response;
|
|
512
|
+
try {
|
|
513
|
+
response = await fetchWithAuth(`${PROXY_URL}/v1/agents/me/pending-actions`, { method: "GET" });
|
|
514
|
+
}
|
|
515
|
+
catch (err) {
|
|
516
|
+
return errorContent(`Network error: ${err instanceof Error ? err.message : err}`);
|
|
517
|
+
}
|
|
518
|
+
const text = await response.text();
|
|
519
|
+
if (!response.ok)
|
|
520
|
+
return errorContent(`Proxy error ${response.status}: ${text}`);
|
|
521
|
+
return { content: [{ type: "text", text }] };
|
|
522
|
+
}
|
|
497
523
|
async function handleReportSelfDiagnostic(args) {
|
|
498
524
|
if (AGENT_PRIVATE_KEY_RAW === null) {
|
|
499
525
|
await notifyBindSecret();
|
package/dist/instructions.js
CHANGED
|
@@ -16,4 +16,7 @@ Response handling:
|
|
|
16
16
|
- Do not retry a denied call with a different scope.
|
|
17
17
|
- If a \`use_platform\` error response includes a \`report_hint\` block, you may briefly ask the user "Want me to lodge this with your AgentValet owner?" — on yes, call \`report_self_diagnostic\` with a one-sentence narrative plus the \`correlation_id\` from the hint so the owner can investigate.
|
|
18
18
|
|
|
19
|
-
Read scopes are auto-approved. Write scopes may require approval. Destructive scopes always require approval
|
|
19
|
+
Read scopes are auto-approved. Write scopes may require approval. Destructive scopes always require approval.
|
|
20
|
+
|
|
21
|
+
Catching up on async actions:
|
|
22
|
+
- If the user mentions a previous action ("did the Slack post go through?", "what happened to that earlier request?") OR if the previous \`use_platform\` returned a \`pending_approval\` envelope, call \`list_my_pending_actions\` to surface what's pending and what's recently completed. Tell the user the result naturally — don't dump the JSON.`;
|