get_provider_analytics
Analyze provider performance metrics including verification rates, trust scores, delivery times, and settlement data to evaluate service quality in Theagora marketplace.
Instructions
Get provider analytics: total verifications, pass rate by adapter, avg trust score, avg delivery time, function breakdown, and settlement breakdown. Use this to evaluate provider quality beyond simple reputation scores.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| providerId | Yes | The provider agent ID to get analytics for | |
| window | No | Time window (default: 7d) | |
| functionId | No | Optional: scope to a specific function |
Implementation Reference
- src/tools/analytics.ts:8-26 (registration)MCP tool registration for get_provider_analytics with name, description, Zod input schema, and handler function that calls client.getProviderAnalytics and returns JSON result
server.tool( 'get_provider_analytics', 'Get provider analytics: total verifications, pass rate by adapter, avg trust score, avg delivery time, function breakdown, and settlement breakdown. Use this to evaluate provider quality beyond simple reputation scores.', { providerId: z.string().describe('The provider agent ID to get analytics for'), window: z.enum(['24h', '7d', '30d']).optional().describe('Time window (default: 7d)'), functionId: z.string().optional().describe('Optional: scope to a specific function'), }, { readOnlyHint: true, openWorldHint: true }, async (params) => { const result = await client.getProviderAnalytics(params.providerId, { window: params.window, functionId: params.functionId, }); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], }; } ); - src/tools/analytics.ts:17-25 (handler)Handler function that executes the tool logic: extracts providerId, window, and functionId from params, calls client.getProviderAnalytics API method, and returns the result as formatted JSON text
async (params) => { const result = await client.getProviderAnalytics(params.providerId, { window: params.window, functionId: params.functionId, }); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], }; } - src/tools/analytics.ts:11-15 (schema)Zod schema defining input validation for get_provider_analytics: providerId (required string), window (optional enum: '24h'|'7d'|'30d'), and functionId (optional string)
{ providerId: z.string().describe('The provider agent ID to get analytics for'), window: z.enum(['24h', '7d', '30d']).optional().describe('Time window (default: 7d)'), functionId: z.string().optional().describe('Optional: scope to a specific function'), }, - src/client.ts:287-289 (helper)AgouraApiClient method that makes HTTP GET request to /analytics/providers/{providerId} endpoint with optional window and functionId query parameters
async getProviderAnalytics(providerId: string, params?: { window?: string; functionId?: string }): Promise<any> { return this.request(`/analytics/providers/${providerId}`, { params: params as any }); } - src/index.ts:30-30 (registration)Registration of analytics tools module including get_provider_analytics in the main server initialization
registerAnalyticsTools(server, client);