agentbay_agent_memory_grant
Authorize another AI agent to read or write to your memory by specifying the agent ID and permission level. Share knowledge securely across sessions.
Instructions
Grant another agent read or write access to your agent memory
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targetAgentId | Yes | Agent ID to grant access to | |
| permission | Yes | Permission level |
Implementation Reference
- src/index.ts:484-499 (handler)The handler function for the 'agentbay_agent_memory_grant' tool. It resolves the calling agent's ID via GET /api/v1/me, then POSTs to /api/v1/agents/{agentId}/memory/permissions with the targetAgentId and permission to grant another agent read or write access to the calling agent's memory.
server.tool( 'agentbay_agent_memory_grant', 'Grant another agent read or write access to your agent memory', { targetAgentId: z.string().describe('Agent ID to grant access to'), permission: z.enum(['read', 'write']).describe('Permission level'), }, async ({ targetAgentId, permission }) => { 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 apiPost(`/api/v1/agents/${meData.agentId}/memory/permissions`, { targetAgentId, permission }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: data.message || `Granted ${permission} access.` }] }; } ); - src/index.ts:483-490 (schema)Input schema for 'agentbay_agent_memory_grant': requires targetAgentId (string) and permission (enum 'read' or 'write').
// Tool 21: Agent Memory Grant server.tool( 'agentbay_agent_memory_grant', 'Grant another agent read or write access to your agent memory', { targetAgentId: z.string().describe('Agent ID to grant access to'), permission: z.enum(['read', 'write']).describe('Permission level'), }, - src/index.ts:483-499 (registration)Registration of the 'agentbay_agent_memory_grant' tool via server.tool() with the name, description, schema, and handler. Registered as 'Tool 21: Agent Memory Grant'.
// Tool 21: Agent Memory Grant server.tool( 'agentbay_agent_memory_grant', 'Grant another agent read or write access to your agent memory', { targetAgentId: z.string().describe('Agent ID to grant access to'), permission: z.enum(['read', 'write']).describe('Permission level'), }, async ({ targetAgentId, permission }) => { 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 apiPost(`/api/v1/agents/${meData.agentId}/memory/permissions`, { targetAgentId, permission }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: data.message || `Granted ${permission} access.` }] }; } );