Skip to main content
Glama
bybit-exchange

Bybit MCP Server

Official

queryReferrals

Read-only

Get friend referrals invited by your authenticated Bybit account. Filter by status and paginate with cursors to review active and closed referral relationships.

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
sizeNo
cursorNo
statusNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.11

TDQS

A4.6/5.0
Behavior5/5

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

The annotations already indicate readOnlyHint and openWorldHint, and the description adds substantial behavioral detail beyond them: cursor-based pagination mechanics, default and maximum page sizes, sorting order, internal fetch of size+1 records, status value meanings, and error conditions such as invalid UID or cursor. This is rich, actionable transparency.

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

Conciseness3/5

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

The description is well-structured with clear headings and lists, but it is quite long and contains repetition, such as restating the scene=2 constraint and business rules multiple times. The use cases section adds limited value beyond what is already stated, so not every sentence earns its place.

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?

With no output schema, the description must explain response data and pagination behavior, and it does thoroughly. It covers record fields, timestamps, cursor semantics, page size rules, error conditions, and authentication requirements. An agent has enough information to call the tool and interpret the result correctly.

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?

Schema description coverage is 0%, so the description carries full responsibility for parameter semantics, and it succeeds. It explains size defaults and range adjustment, cursor requirements (empty or valid int64 string), and status filtering behavior including omitting status to return all records.

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 identifies the action ('Query'), resource ('invited users / referrals'), and scope ('for the authenticated account'). It also distinguishes this tool from siblings by explicitly stating it only returns Friend referral (scene=2) records, which separates it from related referral and account members tools.

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 clear context on when to use the tool, including authentication requirements, supported API key types, and use cases like checking referral status and tracking program performance. It does not explicitly name sibling alternatives or state when not to use it, but the scope limitations are clearly defined.

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

Deploy Server

Other Tools