get_correction_history
Retrieve recent voice transcription corrections to analyze systematic Whisper errors, debug mis-transcriptions, or train vocabulary. Returns original and corrected text, confidence delta, timestamp, and correction source.
Instructions
Return recent voice transcription corrections detected by the user or auto-detected.
Returns correction events: original transcript, corrected text, confidence delta, timestamp, and whether the correction was manual or auto-suggested.
USE WHEN: training the vocabulary, analyzing systemic Whisper errors, or debugging why a specific term keeps mis-transcribing. NOT FOR: vocabulary management — use add_to_vocabulary / remove_from_vocabulary.
BEHAVIOR: pure read. No side effects.
PARAMETERS: limit: max results, ordered newest-first. Range 1-100. Default 20.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- Actual implementation of get_correction_history tool. Queries the activity database for 'correction_detected' events from the 'keys' modality, formats them into a human-readable string with timestamp, original text, corrected text, confidence, correction type, and seconds after paste.
@mcp_app.tool() def get_correction_history(limit: int = 20) -> str: """Get recent Voice correction detections. Shows what words/phrases the user corrected after voice dictation, along with confidence scores and timestamps. These corrections are automatically fed back to Voice's vocabulary for self-improving dictation. Args: limit: Maximum number of corrections to return (default 20). """ limit = max(1, min(limit, 200)) conn = _get_db() if not conn: return "No activity database found." try: rows = conn.execute( "SELECT timestamp, payload FROM events " "WHERE modality = 'keys' AND event_type = 'correction_detected' " "ORDER BY timestamp DESC LIMIT ?", (limit,), ).fetchall() conn.close() if not rows: return "No corrections detected yet. Corrections are captured when you edit Voice-dictated text." lines = [f"=== Correction History (last {len(rows)}) ===\n"] for row in rows: p = json.loads(row["payload"]) ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row["timestamp"])) orig = p.get("original_text", "?") corr = p.get("corrected_text", "?") conf = p.get("confidence", 0) ctype = p.get("correction_type", "?") secs = p.get("seconds_after_paste", 0) lines.append(f"[{ts}] {orig!r} -> {corr!r}") lines.append(f" Type: {ctype}, Confidence: {conf:.0%}, {secs:.1f}s after paste") lines.append("") return "\n".join(lines) except Exception as e: return f"Error reading corrections: {e}" - packages/touch/src/contextpulse_touch/mcp_server.py:182-183 (registration)Tool registered via @mcp_app.tool() decorator on the FastMCP server ('ContextPulse Touch') in the touch package.
@mcp_app.tool() def get_correction_history(limit: int = 20) -> str: - glama/server.py:480-496 (registration)Stub registration in the Glama.ai registry. Returns a message telling users to install ContextPulse locally; this is a discovery-only stub, not the real implementation.
@mcp_app.tool() def get_correction_history(limit: int = 20) -> str: """Return recent voice transcription corrections detected by the user or auto-detected. Returns correction events: original transcript, corrected text, confidence delta, timestamp, and whether the correction was manual or auto-suggested. USE WHEN: training the vocabulary, analyzing systemic Whisper errors, or debugging why a specific term keeps mis-transcribing. NOT FOR: vocabulary management — use add_to_vocabulary / remove_from_vocabulary. BEHAVIOR: pure read. No side effects. PARAMETERS: limit: max results, ordered newest-first. Range 1-100. Default 20. """ return _LOCAL_ONLY_MSG - glama/server.py:480-496 (handler)Glama stub handler for get_correction_history. Returns _LOCAL_ONLY_MSG, as this server is a registry discovery stub, not the actual local daemon.
@mcp_app.tool() def get_correction_history(limit: int = 20) -> str: """Return recent voice transcription corrections detected by the user or auto-detected. Returns correction events: original transcript, corrected text, confidence delta, timestamp, and whether the correction was manual or auto-suggested. USE WHEN: training the vocabulary, analyzing systemic Whisper errors, or debugging why a specific term keeps mis-transcribing. NOT FOR: vocabulary management — use add_to_vocabulary / remove_from_vocabulary. BEHAVIOR: pure read. No side effects. PARAMETERS: limit: max results, ordered newest-first. Range 1-100. Default 20. """ return _LOCAL_ONLY_MSG - Helper function _get_db() that opens a sqlite3 connection to the activity database (ACTIVITY_DB_PATH), used by get_correction_history to fetch correction events.
def _get_db() -> sqlite3.Connection | None: if not _DB_PATH.exists(): return None conn = sqlite3.connect(str(_DB_PATH), timeout=5) conn.row_factory = sqlite3.Row return conn