Home/Tools/@tpmjs/tools-postmortem-draft

postmortemDraftTool

@tpmjs/tools-postmortem-draft

Draft postmortem documents from incident details with timeline and action items. Creates structured incident analysis documentation following SRE best practices.

Official
documentation
v0.2.0
MIT

Interactive Playground

Test @tpmjs/tools-postmortem-draft (postmortemDraftTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-postmortem-draft
pnpm add @tpmjs/tools-postmortem-draft
yarn add @tpmjs/tools-postmortem-draft
bun add @tpmjs/tools-postmortem-draft
deno add npm:@tpmjs/tools-postmortem-draft

2. Import the tool

import { postmortemDraftTool } from '@tpmjs/tools-postmortem-draft';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { postmortemDraftTool } from '@tpmjs/tools-postmortem-draft';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { postmortemDraftTool },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Parameters

Available configuration options

Auto-extracted
title
Required
Type: string

Title of the incident

timeline
Required
Type: array

Array of timeline events

rootCause
Required
Type: string

Root cause analysis of the incident

actionItems
Required
Type: array

Array of action items to prevent recurrence

Schema extracted: 1/1/2026, 8:18:30 AM

README

@tpmjs/tools-postmortem-draft

Draft postmortem documents from incident details with timeline and action items.

Installation

npm install @tpmjs/tools-postmortem-draft

Usage

import { postmortemDraftTool } from '@tpmjs/tools-postmortem-draft';

const result = await postmortemDraftTool.execute({
  title: 'Database Connection Pool Exhaustion',
  timeline: [
    {
      time: '2025-01-15T14:23:00Z',
      event: 'First alerts for elevated error rates',
    },
    {
      time: '2025-01-15T14:25:00Z',
      event: 'Connection pool exhaustion confirmed',
    },
    {
      time: '2025-01-15T14:30:00Z',
      event: 'Emergency pool size increase deployed',
    },
    {
      time: '2025-01-15T14:35:00Z',
      event: 'Service restored, errors subsiding',
    },
    {
      time: '2025-01-15T14:45:00Z',
      event: 'Incident resolved, monitoring continues',
    },
  ],
  rootCause:
    'Database connection pool size was set to 10 connections, which was insufficient for peak traffic. A code deployment earlier that day introduced a connection leak that slowly exhausted the pool.',
  actionItems: [
    'Increase connection pool size from 10 to 50',
    'Add connection pool monitoring and alerting',
    'Review code for connection leaks and add tests',
    'Implement circuit breaker pattern for database calls',
  ],
});

console.log(result.postmortem);
// Markdown-formatted postmortem document
console.log(`Severity: ${result.severity}`);
console.log(`Duration: ${result.duration}`);

Features

  • Generates structured markdown postmortem documents
  • Automatically calculates incident duration from timeline
  • Assesses severity based on incident characteristics
  • Includes timeline, root cause, and action items
  • Follows SRE postmortem best practices
  • Adds placeholder sections for team review

Input

PostmortemDraftInput

  • title (string, required): Title of the incident
  • timeline (array, required): Array of timeline events
  • rootCause (string, required): Root cause analysis
  • actionItems (array, required): Array of action items

TimelineEvent

  • time (string, required): Timestamp of the event (ISO 8601 recommended)
  • event (string, required): Description of what happened

Output

PostmortemDraft

  • postmortem (string): Markdown-formatted postmortem document
  • severity (string): Assessed severity ('low' | 'medium' | 'high' | 'critical')
  • duration (string | null): Calculated incident duration

Severity Assessment

The tool automatically assesses severity based on keywords and timeline:

  • Critical: Complete outage, data loss, security breach
  • High: Major outage, service down, significant customer impact
  • Medium: Degraded performance, partial outage
  • Low: Minor issues, minimal impact

License

MIT

Statistics

Downloads/month

0

Quality Score

0%

Bundle Size

NPM Keywords

tpmjs
documentation
postmortem
incident
sre

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai