Skip to main content
Glama
KarimTarekDev

Facebook Insights Metrics v23

metrics.search

Search Facebook Insights metrics by name, description, or tags to quickly find relevant analytics data for your reporting needs.

Instructions

Performs fuzzy search over metrics by name, description, or tags

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results (default: 20)
qYesSearch query

Implementation Reference

  • Core implementation of the metrics.search tool logic using Fuse.js for fuzzy searching metrics by name, description, tags, and level.
    search(query: string, limit: number = 20): SearchResult[] { if (!query.trim()) { return this.metrics.slice(0, limit).map(metric => ({ item: metric })); } const results = this.fuse.search(query, { limit }); return results.map(result => ({ item: result.item, score: result.score, matches: result.matches ? [...result.matches] : undefined })); }
  • MCP server tool dispatcher case for 'metrics.search', validates input and calls the MetricsSearch engine.
    case 'metrics.search': { const { q, limit = 20 } = args as { q: string; limit?: number }; if (!q) { throw new Error('q parameter is required'); } const searchEngine = this.getSearchEngine(); const results = searchEngine.search(q, limit); return { content: [ { type: 'text', text: JSON.stringify(results, null, 2) } ] }; }
  • Input schema and metadata for the metrics.search tool, returned by listTools.
    { name: 'metrics.search', description: 'Performs fuzzy search over metrics by name, description, or tags', inputSchema: { type: 'object', properties: { q: { type: 'string', description: 'Search query', }, limit: { type: 'number', description: 'Maximum number of results (default: 20)', default: 20, }, }, required: ['q'], }, },
  • Lazy initialization of the MetricsSearch instance used by the metrics.search handler.
    private getSearchEngine(): MetricsSearch { if (!this.searchEngine) { const metrics = this.getMetrics(); this.searchEngine = new MetricsSearch(metrics); } return this.searchEngine; }

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