Skip to main content
Glama
bybit-exchange

Bybit MCP Server

Official

queryReferrals

Retrieve paginated list of friend referral invitations for your Bybit account. Use cursor parameter to navigate through all records.

Instructions

Query invited users (referrals) for the authenticated account. Use master or sub-account's API key.

Important notes (from official Bybit V5 documentation):

  • Returns a list of users invited through friend referral program

  • Supports cursor-based pagination for efficient data retrieval

  • Only returns Friend referral (scene=2) invitation records

  • Results are sorted by invitation ID in descending order (newest first)

  • Maximum page size is 100 records per request

  • Default page size is 20 records if not specified or invalid

Process Flow:

  1. Extract UID from BGW metadata (authentication context)

  2. Validate UID (must be > 0)

  3. Set default page size (20) if not provided or out of range [1-100]

  4. Parse cursor (must be valid int64 string or empty)

  5. Call domain layer QueryReferrals with scene=Friend (2)

  6. Convert domain results to proto response

  7. Set nextCursor if more pages available

  8. Return records with pagination info

Pagination Mechanism:

  • Cursor-based pagination: Use nextCursor from response to fetch next page

  • Initial request: Don't provide cursor parameter (or empty string)

  • Subsequent requests: Use nextCursor value from previous response

  • When nextCursor is empty in response, there are no more pages

  • System fetches (size + 1) records internally to determine if next page exists

Status Values:

  • 0: Common/Active (AVAILABLE) - referral relationship is active

  • 1: Closed/Inactive (UNAVAILABLE) - referral relationship is closed

  • If status parameter not provided, returns all statuses

Response Data:

  • Each record includes invitation ID, invitee UID, status, and timestamps

  • invitee_uid (user_id): The UID of the invited user

  • created_at / updated_at: Unix timestamps in seconds

Business Rules:

  • Only shows Friend referral invitations (scene=2, constant biz.Friend)

  • Must be authenticated with valid API key

  • UID extracted from BGW metadata (ParseBGWParameter)

  • Invalid or missing UID (uid <= 0) returns permission denied error

  • Cursor must be valid integer string (parseable as int64) or empty

  • Page size auto-adjusted: if <= 0 or > 100, defaults to 20

Use Cases:

  • Query all users invited by the authenticated account

  • Check referral invitation status

  • Track referral program performance

  • Export referral data for analysis

  • Monitor active vs closed referral relationships

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNo
sizeNo
statusNo
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description fully bears the burden of behavioral disclosure. It details the process flow (UID extraction, validation, default page size, cursor parsing), pagination mechanism (cursor-based, nextCursor logic), status values, and business rules (e.g., 'Only returns Friend referral invitations'). It also explains error conditions (permission denied for invalid UID) and sorting order (newest first).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is quite long with multiple sections (process flow, pagination, business rules), but it is well-structured and front-loaded with the main purpose. It could be more concise, but the organization aids readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that the tool has no required parameters and no output schema, the description covers all necessary details: return fields (invitee_uid, status, timestamps), pagination mechanism for fetching multiple pages, business rules, authentication requirements, and error handling. It is comprehensive for a query tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 3 parameters with 0% schema description coverage, so the description must add meaning. It thoroughly explains: 'cursor' parameter behavior (initial request omit, subsequent use nextCursor), 'size' defaults and range (1-100, auto-adjusted to 20 if invalid), and 'status' values (0=active, 1=inactive, returns all if omitted). This adds significant value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Query invited users (referrals) for the authenticated account.' It specifies the resource (referrals) and action (query). It distinguishes itself by noting 'Only returns Friend referral (scene=2) invitation records', which differentiates it from other user-related tools like getAffiliateUserList.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides usage context: 'Use master or sub-account's API key' and 'Must be authenticated with valid API key'. It lists use cases (e.g., 'Query all users invited by the authenticated account'). However, it does not explicitly mention when to avoid using this tool or compare it to similar tools like getAffiliateUserInfo.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bybit-exchange/trading-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server