feedback_stats
Analyze feedback data to generate actionable insights and recommendations for improving user experience and system performance.
Instructions
Get feedback stats and recommendations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- workers/src/tools/free.ts:252-285 (handler)The `handleFeedbackStats` function retrieves recent feedback, calculates up/down vote counts, and aggregates tag frequencies to return a summary of feedback statistics.
async function handleFeedbackStats( params: Record<string, unknown>, ownerId: string, env: Env, ): Promise<ToolResult> { const limit = (params.limit as number) ?? 100; const entries = await listFeedback(env, ownerId, limit); const up = entries.filter((e) => e.feedback === 'up').length; const down = entries.filter((e) => e.feedback === 'down').length; const total = entries.length; const tagCounts: Record<string, number> = {}; for (const entry of entries) { for (const tag of entry.tags) { tagCounts[tag] = (tagCounts[tag] ?? 0) + 1; } } const topTags = Object.entries(tagCounts) .sort((a, b) => b[1] - a[1]) .slice(0, 10) .map(([tag, count]) => ({ tag, count })); return textResult( JSON.stringify({ total, up, down, ratio: total > 0 ? (up / total).toFixed(2) : '0.00', topTags, }), ); } - workers/src/tools/free.ts:139-141 (registration)Tool registration for 'feedback_stats' in the main MCP handler switch block.
case 'feedback_stats': return handleFeedbackStats(params, ownerId, env); case 'prevention_rules':