feat: Add get_error_details() for tool failure analysis#61
Conversation
Add endpoint to retrieve detailed error information including the tool
parameters that caused failures. This enables drill-down from aggregate
error counts to actionable specifics.
New MCP tool:
- get_error_details(days, tool, limit) - shows which patterns/commands/files failed
New CLI command:
- session-analytics-cli error-details [--tool NAME] [--limit N]
Key insight: No schema changes needed - uses json_extract() on existing
tool_input_json column to extract Glob/Grep patterns, Bash commands, etc.
Example output:
Glob errors by pattern:
"*" - 922 errors (rust-genai)
"**/*.rs" - 6 errors
Closes #60
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewSummaryThis PR adds a new Issues FoundCriticalNone Important
Suggestions
VerdictREQUEST_CHANGES - Missing tests for the new query function is an important gap that should be addressed before merge. Automated review by Claude Code |
Addresses reviewer feedback on PR #61 requesting test coverage for the new error details query function. Tests cover: - Basic error aggregation by tool and parameter - Tool filter parameter - Limit parameter caps errors per tool - File path errors for Edit/Read/Write - Grep/Glob pattern extraction with search_path - Empty database handling - Days filter excludes old errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewSummaryThis PR adds a Previous Review StatusThe previous review's Important issue (missing tests) has been fully addressed - comprehensive tests were added in Issues FoundCriticalNone ImportantNone Suggestions
VerdictREQUEST_CHANGES - One suggestion for improved CLI UX. Automated review by Claude Code |
Addresses reviewer suggestion for human-readable output instead of raw JSON.
Output now shows errors grouped by tool with counts and context:
Error Details (last 7 days)
Total errors: 3403
Bash (2053 errors):
'pwd': 621 errors (genai)
'ls': 329 errors (gemicro)
...
Glob (943 errors):
'*': 922 errors in /path/to/rust-genai
...
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code ReviewSummaryThis PR adds a Previous Review StatusBoth issues from prior reviews have been addressed:
Issues FoundCriticalNone ImportantNone SuggestionsNone VerdictAPPROVE - Code looks good, no issues found. The implementation follows project conventions (CLI/MCP parity, proper storage API usage), includes thorough tests, and the documentation updates in guide.md and README.md are accurate. Automated review by Claude Code |
Summary
get_error_details()MCP tool to show which specific parameters caused errorserror-detailsCLI commandProblem
analyze_failures()shows "932 Glob errors" but not which patterns failed. Without this, workflow improvements can only identify that errors happen, not why.Solution
Use SQLite's
json_extract()on existingtool_input_jsoncolumn - no schema changes needed.Example output:
Test plan
error-detailscommand worksCloses #60
🤖 Generated with Claude Code