---
name: rtf
displayName: RTF Reader & Converter
description: Read and convert Rich Text Format (.rtf) files to plain text, JSON,
  or Markdown. Use when extracting content from .rtf documents or converting
  them for downstream processing.
tags:
  - rtf
  - document
  - converter
  - reader
  - rich-text-format
capabilities:
  - ReadRtf
  - ConvertToText
  - ConvertToJson
  - ConvertToMarkdown
  - ExtractRtfContent
representativeQueries:
  - Read a .rtf file and show me the content
  - Convert RTF to plain text
  - Extract text from an RTF document
  - Convert RTF file to JSON or Markdown
  - What does this .rtf file contain?
version: 0.1.0
tier: curated
---

# RTF Reader & Converter

Reads Rich Text Format (`.rtf`) files and converts them to plain text, JSON, or Markdown using the bundled Python script. Useful for extracting document content without a word processor or for feeding RTF content into downstream pipelines.

## When to use

- A user provides a `.rtf` file path and wants to read or process its contents.
- You need to extract text from a legacy word-processor document saved in RTF format.
- You want to convert RTF content to a format suitable for analysis, CSV generation, or storage.
- You need a quick plain-text or Markdown rendering of an RTF file without installing office software.

## Steps

1. **Detect format.** Confirm the file exists and begins with `{\rtf1` — if not, report that the file is not valid RTF.
2. **Route by task.** Determine the output format the user wants: plain text (default), JSON (structured metadata + text), or Markdown (preserves basic formatting cues).
3. **Run the converter.** Execute `python3 scripts/convert_rtf.py <file_path> [--format text|json|markdown]`. The script reads the file, strips RTF control sequences, and emits the requested format to stdout.
4. **Surface the output.** Display the result inline, or write it to a file if the user requests a saved output.

## Output

- **text** (default): plain UTF-8 string with paragraph breaks preserved as newlines.
- **json**: `{"filename": "...", "format": "rtf", "text": "...", "paragraphs": [...]}`.
- **markdown**: headings inferred from paragraph style markers; bold/italic preserved where detectable.

## Notes

- Pure stdlib implementation — no pip installs required.
- RTF files embedding binary objects (images, OLE objects) are handled gracefully: binary blobs are skipped.
- For very large RTF files (>10 MB), the converter processes the full file but output may be long — consider piping to a file.
- Optional destinations (`{\*\...}` groups) are always skipped per RTF spec.
- If the file uses an unusual codepage, output is best-effort; characters outside ASCII may not decode perfectly.

<!-- runner-fallback -->
## Remote runner (MCP)
Can't run this locally (no setup, missing dependency)? The StealthStack runner exposes the **same code** as server-side MCP tools — no local install needed: `rtf_to_text`, `rtf_to_json`, `rtf_to_markdown`. Call the `application/mcp` catalog twin of this skill (its `runnerTwin`).
