agentbay_agent_memory_revoke
Revoke another agent's access to your agent memory by providing its Agent ID. Use this to remove previously granted permissions and control which agents can retrieve your stored information.
Instructions
Revoke another agent's access to your agent memory
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targetAgentId | Yes | Agent ID to revoke access from |
Implementation Reference
- src/index.ts:501-516 (handler)The handler function for the 'agentbay_agent_memory_revoke' tool. It revokes another agent's read/write access to the calling agent's memory by calling GET /api/v1/me to resolve the agent ID, then DELETE /api/v1/agents/{agentId}/memory/permissions with the targetAgentId as a query parameter.
// Tool 22: Agent Memory Revoke server.tool( 'agentbay_agent_memory_revoke', 'Revoke another agent\'s access to your agent memory', { targetAgentId: z.string().describe('Agent ID to revoke access from'), }, async ({ targetAgentId }) => { const meData = await apiGet('/api/v1/me'); if (!meData.agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key.' }] }; const data = await apiDelete(`/api/v1/agents/${meData.agentId}/memory/permissions?targetAgentId=${targetAgentId}`); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: data.message || 'Permission revoked.' }] }; } ); - src/index.ts:501-516 (registration)The tool is registered via server.tool() with the name 'agentbay_agent_memory_revoke' and a description of 'Revoke another agent's access to your agent memory'.
// Tool 22: Agent Memory Revoke server.tool( 'agentbay_agent_memory_revoke', 'Revoke another agent\'s access to your agent memory', { targetAgentId: z.string().describe('Agent ID to revoke access from'), }, async ({ targetAgentId }) => { const meData = await apiGet('/api/v1/me'); if (!meData.agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key.' }] }; const data = await apiDelete(`/api/v1/agents/${meData.agentId}/memory/permissions?targetAgentId=${targetAgentId}`); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: data.message || 'Permission revoked.' }] }; } ); - src/index.ts:505-507 (schema)The input schema defines a single required parameter 'targetAgentId' (string) describing the agent ID to revoke access from.
{ targetAgentId: z.string().describe('Agent ID to revoke access from'), }, - src/index.ts:186-193 (helper)The apiDelete helper function used by the handler to make the DELETE request to revoke permissions.
async function apiDelete(path: string, body?: unknown) { const res = await fetch(`${API_BASE}${path}`, { method: 'DELETE', headers: getHeaders(), ...(body ? { body: JSON.stringify(body) } : {}), }); return res.json(); }