Skip to main content
Glama
KarimTarekDev

Facebook Insights Metrics v23

metrics.refreshNow

Refresh the in-memory cache by re-parsing the Markdown file to ensure access to current Facebook Insights metrics data.

Instructions

Re-parses the Markdown file and reloads the in-memory cache

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the metrics.refreshNow tool: calls refreshMetrics() and returns success response.
    case 'metrics.refreshNow': {
      await this.refreshMetrics();
      return {
        content: [
          {
            type: 'text',
            text: 'Metrics refreshed successfully'
          }
        ]
      };
    }
  • src/server.ts:118-125 (registration)
    Registration of metrics.refreshNow tool including name, description, and input schema.
    {
      name: 'metrics.refreshNow',
      description: 'Re-parses the Markdown file and reloads the in-memory cache',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Core helper function implementing metric refresh: parses markdown, saves to loader, clears cache, updates search engine.
    private async refreshMetrics(): Promise<void> {
      try {
        const parser = new MarkdownParser(this.markdownPath);
        const parsedMetrics = parser.parseMetrics();
        
        const metricsFile: MetricsFile = {
          version: parser.getVersion(),
          updatedAt: parser.getLastUpdated(),
          metrics: parsedMetrics
        };
    
        this.metricsLoader.saveMetrics(metricsFile);
        this.metricsLoader.clearCache();
        
        // Update search engine
        this.searchEngine = new MetricsSearch(parsedMetrics);
        
        // console.log(`Refreshed ${parsedMetrics.length} metrics from markdown`);
      } catch (error) {
        console.error('Failed to refresh metrics:', error);
        throw error;
      }
    }

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/KarimTarekDev/facebook-insights-metrics-v23'

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