fetch_profile
Retrieve detailed profile data for a Vector trader by providing their username. Get a JSON string containing trader profile information.
Instructions
Fetch detailed profile data for a Vector trader
Args:
username: Vector username to fetch
Returns:
JSON string with profile dataInput Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- vector_server.py:318-359 (handler)Handler function for the fetch_profile tool. Takes a username, builds a GraphQL payload using PROFILE_QUERY, posts it to the Vector API, and returns the JSON response.
@mcp.tool(name="fetch_profile") async def fetch_profile( username: str, ctx: Context = None ) -> str: """Fetch detailed profile data for a Vector trader Args: username: Vector username to fetch Returns: JSON string with profile data """ if ctx: ctx.info(f"Fetching profile data for {username}...") # Hardcoded variables as requested variables = { "username": username, "cursor": None, "count": 10 } payload = { "query": PROFILE_QUERY, "variables": variables } async with httpx.AsyncClient(verify=False) as client: try: response = await client.post( API_URL, json=payload, headers=HEADERS ) response.raise_for_status() return response.text except Exception as e: error_message = f"Error fetching profile data: {str(e)}" if ctx: ctx.error(error_message) return error_message - vector_server.py:107-208 (schema)GraphQL query used by fetch_profile. Fetches profile info, holdings, and recent broadcasts for a given username.
PROFILE_QUERY = """ query UsernameProfileQuery( $username: String! $cursor: String $count: Int ) { profile(username: $username, refcode: $username) { id username moderationState twitterUsername followerCountX followerCount weeklyLeaderboardStanding(leaderboardType: PNL_WIN) { rank value } profileLeaderboardValues { daily { pnl volume maxTradeSize } weekly { pnl volume maxTradeSize } } } userHoldings(id: $username, after: $cursor, first: $count) { edges { cursor node { portfolioPercentage token { id address chain name symbol image } } } pageInfo { hasNextPage endCursor } } userBroadcastsV2(id: $username, after: $cursor, first: $count) { edges { cursor node { broadcast { id message createdAt buyTokenId buyTokenAmount buyPositionSize buyTokenPrice: buyTokenPriceV2 sellTokenId sellTokenAmount sellPositionSize sellTokenPrice: sellTokenPriceV2 broadcastCandleChart { cycleStats { pnl totalBought totalHeld totalSold } } } buyToken { id chain name symbol price image address } sellToken { id chain name symbol price image address } } } pageInfo { endCursor hasNextPage } } } """ - vector_server.py:318-318 (registration)Registration of the fetch_profile tool using the @mcp.tool decorator.
@mcp.tool(name="fetch_profile")