Skip to main content
Glama

get_token_historical_data

Retrieve historical price and trading data for a specific token on SailFish DEX by specifying the token address and desired time range in days.

Instructions

Get historical data for a token on SailFish DEX

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNoNumber of days of data to return (default: 7)
tokenIdYesToken address

Implementation Reference

  • Core handler function that executes the GraphQL query to fetch historical daily data for the specified token from the SailFish subgraph.
    export async function getTokenDayData(tokenId: string, count: number = 7): Promise<TokenDayData[]> {
      try {
        const data = await request<TokenDayDataQueryResult>(
          SUBGRAPH_URL,
          TOKEN_DAY_DATA_QUERY,
          { tokenId: tokenId.toLowerCase(), count }
        );
        return data.tokenDayDatas;
      } catch (error) {
        console.error('Error fetching token day data:', error);
        throw error;
      }
    }
  • src/index.ts:833-849 (registration)
    MCP CallToolRequestSchema handler registration for 'get_token_historical_data': validates parameters, delegates to subgraph.getTokenDayData, formats and returns response.
    case 'get_token_historical_data': {
      if (!args.tokenId || typeof args.tokenId !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Token ID is required');
      }
      
      const days = typeof args.days === 'number' ? args.days : 7;
      const data = await subgraph.getTokenDayData(args.tokenId, days);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the tool, used in ListToolsRequestSchema response.
    name: 'get_token_historical_data',
    description: 'Get historical data for a token on SailFish DEX',
    inputSchema: {
      type: 'object',
      properties: {
        tokenId: {
          type: 'string',
          description: 'Token address',
        },
        days: {
          type: 'number',
          description: 'Number of days of data to return (default: 7)',
        },
      },
      required: ['tokenId'],
    },
  • GraphQL query definition used by getTokenDayData to retrieve token historical day data.
    const TOKEN_DAY_DATA_QUERY = gql`
      query getTokenDayData($tokenId: String!, $count: Int!) {
        tokenDayDatas(
          first: $count
          orderBy: date
          orderDirection: desc
          where: { token: $tokenId }
        ) {
          id
          date
          token {
            id
            symbol
            name
          }
          volume
          volumeUSD
          untrackedVolumeUSD
          totalValueLocked
          totalValueLockedUSD
          priceUSD
          feesUSD
          open
          high
          low
          close
        }
      }

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/SailFish-Finance/educhain-ai-agent-kit'

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