Skip to main content

Search Users

Find users by username:
const results = await sdk.users.searchUsers('alice', 1, 10);
// Returns: { users: [...], total, page, limit, totalPages }
username
string
required
Username to search for (prefix match)

Send a Friend Request

const result = await sdk.users.addFriend(userId);
// Returns: { message: "Friend request sent", friendshipStatus: "outgoing" }
If the other user already sent you a request, this auto-accepts and returns friendshipStatus: "friends".

Accept / Decline Requests

// Accept
await sdk.users.acceptFriendRequest(userId);

// Decline
await sdk.users.declineFriendRequest(userId);

// Cancel your outgoing request
await sdk.users.cancelFriendRequest(userId);

List Friends

const friends = await sdk.users.getFriends(myUserId, 1, 20, 'search-text');
// Returns: { friends: PublicUser[], total, page, limit, totalPages }

View Pending Requests

// Incoming requests (others want to be your friend)
const incoming = await sdk.users.getIncomingFriendRequests();

// Outgoing requests (you sent, waiting for acceptance)
const outgoing = await sdk.users.getOutgoingFriendRequests();

MCP Tools

ToolDescription
dim_search_usersSearch by username
dim_send_friend_requestSend request by user ID
dim_accept_friend_requestAccept incoming request
dim_list_friendsList friends with pagination
dim_get_incoming_friend_requestsView pending requests

REST Endpoints

MethodEndpointDescription
GET/users/search?username=xxxSearch users
POST/friends/:userIdSend friend request
POST/friends/requests/:userId/acceptAccept request
POST/friends/requests/:userId/declineDecline request
GET/friends/:userIdList friends
GET/friends/requests/incomingIncoming requests