Amba

Friends

Friend requests, accept/reject, block/unblock, and friend lists.

The friends system lets users connect with each other through friend requests.

SDK usage

Every friends method returns friendships from the signed-in user's side: user_id is the user, friend_id the other user, and state is pending, accepted or blocked. Each friendship also carries requester_id and addressee_id, so the direction of a pending request stays readable.

Send a friend request

// The argument is the other user's id.
const friendship = await client.friends.sendRequest(otherUserId);

sendRequest posts { "addressee_id": "<the other user's id>" } to POST /v1/client/friends/request and returns the pending friendship.

Accept a request

await client.friends.acceptRequest(friendshipId);

Decline a request

await client.friends.declineRequest(friendshipId);

Block/unblock

Both take the other user's id.

await client.friends.blockUser(otherUserId);
await client.friends.unblockUser(otherUserId);

Remove a friend

await client.friends.removeFriend(otherUserId);

Get friends list

const friends = await client.friends.getFriends(); // accepted friendships

Get pending requests

getList returns the accepted friendships, then the pending requests in both directions, each newest first, up to 1000 rows:

const all = await client.friends.getList();
const incoming = all.filter((f) => f.state === 'pending' && f.addressee_id === f.user_id);
const outgoing = all.filter((f) => f.state === 'pending' && f.requester_id === f.user_id);

Pass an incoming request's id to acceptRequest or declineRequest. Over HTTP, GET /v1/client/friends/pending lists the incoming requests alone, each with the requester's id, display_name and avatar_url.

Blocked users don't appear in either list. blockUser returns the blocked friendship, whose id removeBlock takes.

Client API reference

MethodPathDescription
POST/v1/client/friends/requestSend friend request (addressee_id)
POST/v1/client/friends/:id/acceptAccept request
POST/v1/client/friends/:id/rejectDecline request
POST/v1/client/friends/blockBlock a user (user_id)
POST/v1/client/friends/unblockUnblock a user (user_id)
POST/v1/client/friends/:id/blockBlock by friendship id
POST/v1/client/friends/:id/unblockUnblock by friendship id
DELETE/v1/client/friends/by-user/:userIdRemove a friend
DELETE/v1/client/friends/:idClear a block by friendship id
GET/v1/client/friendsList accepted + pending friendships
GET/v1/client/friends/pendingList pending requests

MCP tools

ToolDescription
amba_friendships_get_statsGet friendship statistics (total, pending, accepted, blocked)

On this page