Skip to main content
Glama
zarelli1

MCP DeFiLlama Airdrops

by zarelli1

debug_scraper

Verify and debug the scraping functionality to ensure accurate retrieval of cryptocurrency airdrop data from DeFiLlama, supporting seamless integration with automation workflows.

Instructions

Debugar o scraper para verificar se está funcionando corretamente

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'debug_scraper' tool. It invokes the scraper's debugPage method, formats the result as MCP content, and handles errors.
    private async debugScraper() {
      try {
        const debugInfo = await this.scraper.debugPage();
        return {
          content: [
            {
              type: 'text',
              text: `Debug Info:\n${debugInfo}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Erro no debug: ${error}`
            }
          ]
        };
      }
    }
  • The input schema definition for the 'debug_scraper' tool, registered in the ListTools handler. It takes no parameters.
    {
      name: 'debug_scraper',
      description: 'Debugar o scraper para verificar se está funcionando corretamente',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    }
  • src/index.ts:134-136 (registration)
    The switch case in the CallToolRequestSchema handler that routes requests for 'debug_scraper' to the debugScraper handler method.
    case 'debug_scraper':
      return await this.debugScraper();
  • The helper method in DeFiLlamaScraper that performs the actual debugging: fetches the airdrops page, parses with cheerio, extracts structural info, and returns JSON details for debugging the scraper.
    async debugPage(): Promise<string> {
      try {
        console.log('Fazendo debug da página...');
        const response = await this.axiosInstance.get('https://defillama.com/airdrops');
        const $ = cheerio.load(response.data);
    
        const pageInfo = {
          title: $('title').text(),
          url: 'https://defillama.com/airdrops',
          status: response.status,
          headers: response.headers['content-type'],
          bodyLength: response.data.length,
          elementCounts: {
            total: $('*').length,
            tables: $('table').length,
            divs: $('div').length,
            links: $('a').length,
            rows: $('tr').length
          },
          sampleText: $('body').text().slice(0, 500),
          foundStructures: {
            tableRows: $('table tbody tr').length,
            airdropElements: $('[class*="airdrop"]').length,
            itemElements: $('[class*="item"]').length
          }
        };
    
        return JSON.stringify(pageInfo, null, 2);
      } catch (error) {
        return `Erro no debug: ${error}`;
      }
    }
Install Server

Other Tools

Related 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/zarelli1/mcp-defillama-airdrops'

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