Implements a comprehensive suite of AI SDK v6 tools across multiple categories: - Research (5): page-brief, compare-pages, source-credibility, claim-checklist, timeline-from-text - Web (10): fetch-text, links-catalog, extract-meta, extract-json-ld, redirect-trace, sitemap-read, rss-read, table-extract, robots-policy, url-normalize - Data (15): csv-parse, csv-stringify, json-repair, json-schema-validate, yaml-parse, yaml-stringify, text-chunk, normalize-whitespace, dedupe-by-key, pivot, rows-filter, rows-sort, rows-group-aggregate, rows-join, schema-infer - Doc (12): toc-generate, glossary-build, faq-from-text, executive-brief, decision-record-adr, prd-outline, acceptance-criteria, style-rewrite - Eng (12): diff-text-unified, env-var-docs-generate, dependency-audit-lite, conventional-commit-suggest, markdown-lint-basic, test-case-generate, stacktrace-parse, release-notes, changelog-entry, release-checklist - Security (7): redact-secrets, secret-scan-text, url-risk-heuristic, csp-compose, hardening-checklist-web, access-control-matrix, data-classification-heuristic - Stats (9): effect-size-suite, bootstrap-ci, permutation-test, multiple-testing-adjust, linear-regression-ols, logistic-regression, time-series-decompose-lite, anomaly-detect-mad - Ops (7): slo-draft, runbook-draft, postmortem-draft, postmortem-action-extractor, error-log-triage, coverage-tracker, monitoring-gap-analysis - Agent (15): prompt-to-workflow-skeleton, workflow-validate-io, workflow-explain, workflow-cost-estimate, tool-call-accuracy-score, eval-fixture-build, guardrail-policy-draft, workflow-auto-repair, tool-selection-plan, novelty-score-workflow, workflow-variant-generate, config-normalize, recipe-* - Utility (8): base64-encode, base64-decode, hash-text, regex-extract, template-render, date-parse, json-path-query, url-parse - HTML (3): html-sanitize, html-to-markdown, markdown-to-html All tools follow AI SDK v6 pattern with tool() and jsonSchema<T>(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.5 KiB
3.5 KiB
Error Log Triage Tool
Triages error logs by severity and frequency, groups similar errors, and provides actionable recommendations for debugging.
Installation
npm install @tpmjs/tools-error-log-triage
Usage
import { errorLogTriageTool } from '@tpmjs/tools-error-log-triage';
const result = await errorLogTriageTool.execute({
logs: [
{
message: 'Database connection failed to postgres://localhost:5432',
level: 'error',
timestamp: '2025-01-15T10:30:00Z'
},
{
message: 'Database connection failed to postgres://localhost:5433',
level: 'error',
timestamp: '2025-01-15T10:30:05Z'
},
{
message: 'Null reference error at user.service.ts:45',
level: 'error',
timestamp: '2025-01-15T10:31:00Z'
}
]
});
console.log(result);
// {
// groups: [
// {
// pattern: 'Database connection failed to [URL]',
// count: 2,
// severity: 'error',
// firstOccurrence: '2025-01-15T10:30:00Z',
// lastOccurrence: '2025-01-15T10:30:05Z',
// examples: [
// 'Database connection failed to postgres://localhost:5432',
// 'Database connection failed to postgres://localhost:5433'
// ]
// },
// // ... more groups
// ],
// severityCounts: {
// critical: 0,
// error: 3,
// warning: 0,
// info: 0
// },
// recommendations: [
// 'Check network and database connectivity - 2 connection error(s) detected',
// 'Add null checks - 1 null/undefined reference error(s) detected'
// ],
// summary: {
// totalLogs: 3,
// uniquePatterns: 2,
// timeRange: '2025-01-15T10:30:00Z to 2025-01-15T10:31:00Z'
// }
// }
Features
- Pattern Recognition: Groups similar errors by normalizing messages (removes IDs, paths, timestamps, URLs)
- Severity Mapping: Automatically maps log levels to standardized severities (critical, error, warning, info)
- Time Tracking: Tracks first and last occurrence of each error pattern
- Smart Recommendations: Generates actionable debugging recommendations based on error patterns
- Frequency Analysis: Identifies high-frequency errors that indicate systemic issues
Input
{
logs: Array<{
message: string; // The error message or log text
level: string; // Log level (error, warning, info, critical, fatal, etc.)
timestamp: string; // ISO 8601 timestamp
}>
}
Output
{
groups: Array<{
pattern: string; // Normalized error pattern
count: number; // Number of occurrences
severity: string; // Mapped severity level
firstOccurrence: string; // ISO timestamp of first occurrence
lastOccurrence: string; // ISO timestamp of last occurrence
examples: string[]; // Up to 3 example messages
}>,
severityCounts: {
critical: number;
error: number;
warning: number;
info: number;
},
recommendations: string[]; // Actionable debugging recommendations
summary: {
totalLogs: number;
uniquePatterns: number;
timeRange: string;
}
}
Pattern Normalization
The tool normalizes error messages to group similar errors:
- File paths →
[PATH] - UUIDs →
[UUID] - IDs →
[ID] - Timestamps →
[TIMESTAMP] - URLs →
[URL] - IP addresses →
[IP] - Line numbers →
[LINE] - Generic numbers →
[NUM]
Example:
"Error in /app/user.service.ts:45 for user ID 12345"
→ "Error in [PATH]:[LINE] for user ID [ID]"
License
MIT