fetch_token_data
Fetch trending Solana tokens from Vector and receive a JSON string with token data.
Instructions
Fetch trending Solana tokens from Vector
Returns:
JSON string with token dataInput Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- vector_server.py:361-361 (registration)Tool registration decorator for 'fetch_token_data'
@mcp.tool(name="fetch_token_data") - vector_server.py:361-400 (handler)Handler function that fetches trending Solana tokens from Vector GraphQL API using the TOKENS_LIST_QUERY
@mcp.tool(name="fetch_token_data") async def fetch_token_data( ctx: Context = None ) -> str: """Fetch trending Solana tokens from Vector Returns: JSON string with token data """ if ctx: ctx.info("Fetching trending Solana tokens...") # Hardcoded variables as requested variables = { "count": 50, "cursor": None, "filterBy": "(broadcastCount5minV2:>0) && (chain:SOLANA)", "query": None, "sortBy": "trendingScore5min:desc" } payload = { "query": TOKENS_LIST_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 token data: {str(e)}" if ctx: ctx.error(error_message) return error_message - vector_server.py:210-244 (schema)TOKENS_LIST_QUERY GraphQL query definition used by fetch_token_data to fetch token data fields
# Token list query TOKENS_LIST_QUERY = """ query TokensListRefetchQuery( $count: Int = 25 $cursor: String $filterBy: String $query: String $sortBy: String ) { searchTokens(query: $query, sortBy: $sortBy, filterBy: $filterBy, after: $cursor, first: $count) { edges { node { id address chain symbol price supply volume5min volume1h volume6h volume24h broadcastCount5min broadcastCount1h broadcastCount6h broadcastCount24h top10HolderPercentV2 firstIndexedTimestamp insiderHoldingPercent devHoldingPercent } } } } """ - vector_server.py:15-28 (helper)API_URL and HEADERS config used by fetch_token_data for the HTTP request
# API endpoint and headers API_URL = "https://mainnet-api.vector.fun/graphql" HEADERS = { "Host": "mainnet-api.vector.fun", "content-type": "application/json", "X-App-Version": "1.11.0", "X-App-Build-Number": "331", "accept": "*/*", "x-app-name": "Vector", "Accept-Language": "en-US;q=1", "user-agent": "Vector/331 CFNetwork/1568.200.51 Darwin/24.1.0", "pragma": "no-cache", "cache-control": "no-cache" }