check_permission
Verify whether a permission request has been approved, denied, or remains pending by providing the request ID.
Instructions
Check the status of a previously submitted permission request. Returns a JSON object with status ('pending', 'approved', or 'denied'). Use this after calling request_permission to poll for the human owner's decision. Do not call this without a valid request_id from a prior request_permission call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request_id | Yes | The request ID returned from request_permission |
Implementation Reference
- src/src/index.ts:942-959 (handler)The handler function that executes the check_permission tool logic. Makes an HTTP GET request to the permission API endpoint with the agent key and request_id, and returns the permission status ('pending', 'approved', or 'denied').
async function handleCheckPermission(args: { request_id: number; }): Promise<string> { const params = new URLSearchParams({ agent_key: AGENT_KEY, request_id: String(args.request_id), }); const result = (await fetchJSON( `${API_BASE}/permission?${params.toString()}` )) as { status?: string; error?: string }; if (result.error) { return `Failed to check permission: ${result.error}`; } return `Permission status: ${result.status}`; } - src/src/index.ts:377-391 (schema)Schema definition for the check_permission tool. Defines the tool name, description, and input schema requiring a 'request_id' (number) parameter.
{ name: "check_permission", description: "Check the status of a previously submitted permission request. Returns 'pending', 'approved', or 'denied'.", inputSchema: { type: "object" as const, properties: { request_id: { type: "number", description: "The request ID returned from request_permission", }, }, required: ["request_id"], }, }, - src/src/index.ts:1342-1345 (registration)Registration of the check_permission tool in the tools/call handler switch statement. Routes the 'check_permission' tool name to the handleCheckPermission function with the appropriate type cast.
case "check_permission": resultText = await handleCheckPermission( toolArgs as { request_id: number } );