YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
feat(mcp): add UI events support and bump to v0.7.0
Louis Beaumont1af77225764e
diff --git a/.claude/agents/screenpipe-query.md b/.claude/agents/screenpipe-query.mdindex 1ddcfd42e..9766f0177 100644--- a/.claude/agents/screenpipe-query.md+++ b/.claude/agents/screenpipe-query.md@@ -1,6 +1,6 @@---name: screenpipe-query-description: Query your Screenpipe data (screen OCR, audio transcriptions, UI elements) via REST API or direct SQL+description: Query your Screenpipe data (screen OCR, audio transcriptions, UI/accessibility events) via REST API or direct SQLtools:- Bash- WebFetch@@ -8,7 +8,10 @@ tools:# Screenpipe Query Agent-You are a specialized agent for querying Screenpipe data. Screenpipe captures everything on the user's screen (OCR), audio (transcriptions), and UI elements.+You are a specialized agent for querying Screenpipe data. Screenpipe captures three modalities:+1. **Vision (OCR)** - Screen text from screenshots+2. **Audio** - Transcribed speech from microphone/system audio+3. **UI Events (Accessibility)** - Keyboard input, mouse clicks, app switches, clipboard (macOS)## Data Access Methods@@ -16,7 +19,7 @@ You are a specialized agent for querying Screenpipe data. Screenpipe captures evThe Screenpipe server runs at `http://localhost:3030`. Use curl to query:```bash-# Search all content+# Search all content (OCR + audio)curl "http://localhost:3030/search?q=QUERY&limit=20"# Filter by content type: ocr, audio, ui, all@@ -33,6 +36,24 @@ curl "http://localhost:3030/search?q=QUERY&limit=50&offset=0"# Health checkcurl "http://localhost:3030/health"++# === UI Events API (Accessibility data - macOS) ===++# Search UI events (keyboard input, clicks, app switches, clipboard)+curl "http://localhost:3030/ui-events?limit=50"++# Filter by event type: click, text, scroll, key, app_switch, window_focus, clipboard+curl "http://localhost:3030/ui-events?event_type=text&limit=50"++# Filter UI events by app+curl "http://localhost:3030/ui-events?app_name=Slack&limit=50"++# Filter UI events by time range+curl "http://localhost:3030/ui-events?start_time=2024-01-01T10:00:00Z&end_time=2024-01-01T12:00:00Z"++# Get UI event statistics (app usage, event counts)+curl "http://localhost:3030/ui-events/stats"+curl "http://localhost:3030/ui-events/stats?start_time=2024-01-01T00:00:00Z"```### Method 2: Direct SQL (if CLI available)@@ -72,9 +93,9 @@ ORDER BY timestamp DESCLIMIT 20;```-### UI Monitoring+### UI Monitoring (Legacy)```sql--- ui_monitoring: captured UI elements+-- ui_monitoring: captured UI elements (legacy table)SELECT text_output, app, window, timestampFROM ui_monitoringWHERE text_output LIKE '%search_term%'@@ -82,16 +103,57 @@ ORDER BY timestamp DESCLIMIT 20;```+### UI Events (Accessibility - macOS)+```sql+-- ui_events: keyboard input, mouse clicks, app switches, clipboard+-- Event types: click, text, scroll, key, app_switch, window_focus, clipboard++-- Recent keyboard input (what was typed)+SELECT text_content, app_name, window_title, timestamp+FROM ui_events+WHERE event_type = 'text'+ORDER BY timestamp DESC+LIMIT 20;++-- Recent mouse clicks with element context+SELECT app_name, window_title, x, y, element_label, timestamp+FROM ui_events+WHERE event_type = 'click'+ORDER BY timestamp DESC+LIMIT 20;++-- App switches (which apps were used)+SELECT app_name, window_title, timestamp+FROM ui_events+WHERE event_type = 'app_switch'+ORDER BY timestamp DESC+LIMIT 50;++-- Clipboard history+SELECT text_content, app_name, timestamp+FROM ui_events+WHERE event_type = 'clipboard'+ORDER BY timestamp DESC+LIMIT 20;+```+### Useful Queries```sql--- What apps have I used today?+-- What apps have I used today? (from frames)SELECT DISTINCT app_name, COUNT(*) as framesFROM framesWHERE timestamp > datetime('now', '-1 day')GROUP BY app_nameORDER BY frames DESC;+-- What apps have I used today? (from UI events - more accurate for activity)+SELECT app_name, event_type, COUNT(*) as count+FROM ui_events+WHERE timestamp > datetime('now', '-1 day')+GROUP BY app_name, event_type+ORDER BY count DESC;+-- Recent screen content from specific appSELECT ot.text, f.timestamp, f.window_nameFROM ocr_text ot@@ -107,6 +169,23 @@ FROM audio_transcriptionsWHERE timestamp > datetime('now', '-2 hours')AND LENGTH(transcription) > 50ORDER BY timestamp DESC;++-- What did I type in the last hour?+SELECT text_content, app_name, window_title, timestamp+FROM ui_events+WHERE event_type = 'text'+ AND timestamp > datetime('now', '-1 hour')+ORDER BY timestamp DESC;++-- Most clicked elements today+SELECT app_name, element_label, COUNT(*) as clicks+FROM ui_events+WHERE event_type = 'click'+ AND timestamp > datetime('now', '-1 day')+ AND element_label IS NOT NULL+GROUP BY app_name, element_label+ORDER BY clicks DESC+LIMIT 20;```## Response Format@@ -123,7 +202,11 @@ When returning results to the user:- **"Find mentions of X"** → Full-text search across all content types- **"Meeting notes about Y"** → Search audio transcriptions- **"Code I was looking at"** → Search OCR filtered by IDE apps (Code, Cursor, etc.)-- **"Time spent in app X"** → Query frames table, aggregate by app_name+- **"Time spent in app X"** → Query UI events stats or frames table by app_name+- **"What did I type?"** → Query UI events with event_type=text+- **"What did I click on?"** → Query UI events with event_type=click+- **"What apps did I use?"** → Query UI events stats endpoint or app_switch events+- **"What did I copy/paste?"** → Query UI events with event_type=clipboard## Error Handlingdiff --git a/content/docs-mintlify-mig-tmp/architecture.mdx b/content/docs-mintlify-mig-tmp/architecture.mdxindex 4f442f651..99e57d224 100644--- a/content/docs-mintlify-mig-tmp/architecture.mdx+++ b/content/docs-mintlify-mig-tmp/architecture.mdx@@ -15,7 +15,7 @@ at its core, screenpipe acts as a bridge between your digital activities and ai- **screen recording**: captures visual content at configurable frame rates- **audio recording**: captures spoken content from multiple sources-- **ui monitoring**: (experimental) captures accessibility metadata about ui elements+- **ui events (accessibility)**: captures keyboard input, mouse clicks, app switches, clipboard events via accessibility APIs (macOS)### processing layer@@ -61,7 +61,7 @@ here's the typical data flow through the screenpipe system:1. **capture**- screen is captured at the configured fps (default 1.0, or 0.5 on macos)- audio is captured in chunks (default 30 seconds)- - ui events are optionally captured (macos only currently)+ - ui events (keyboard, mouse, app switches, clipboard) are captured via accessibility APIs (macos, enable in settings)2. **processing**- captured frames are processed through ocr to extract text- audio chunks are processed through stt to generate transcriptionsdiff --git a/content/docs-mintlify-mig-tmp/claude-code.mdx b/content/docs-mintlify-mig-tmp/claude-code.mdxindex b71b6dc4f..5d91b1ffb 100644--- a/content/docs-mintlify-mig-tmp/claude-code.mdx+++ b/content/docs-mintlify-mig-tmp/claude-code.mdx@@ -56,7 +56,9 @@ once connected, Claude Code has access to these tools:| tool | description ||------|-------------|-| `search-content` | search screen OCR, audio transcriptions, UI elements with time/app filters |+| `search-content` | search screen OCR, audio transcriptions with time/app filters |+| `search-ui-events` | search accessibility data: keyboard input, mouse clicks, app switches, clipboard (macOS) |+| `get-ui-event-stats` | get aggregated UI event statistics by app and event type || `export-video` | create video exports from screen recordings |## usage examples@@ -73,11 +75,19 @@ ask Claude Code to use screenpipe naturally:> what code was I reading in VS Code yesterday about async?> export a video of my screen from 2-3pm today++> what did I type in Slack today?++> show me my app usage stats for the past 2 hours++> what did I copy to clipboard recently?++> which apps did I switch between most today?```## search parameters-the `search-content` tool supports these parameters:+### search-content (screen OCR + audio)| parameter | description ||-----------|-------------|@@ -93,6 +103,27 @@ the `search-content` tool supports these parameters:| `speaker_ids` | comma-separated speaker IDs for audio filtering || `speaker_name` | filter audio by speaker name |+### search-ui-events (accessibility data - macOS)++| parameter | description |+|-----------|-------------|+| `q` | search text content, app name, window title |+| `event_type` | `click`, `text`, `scroll`, `key`, `app_switch`, `window_focus`, `clipboard` |+| `app_name` | filter by application |+| `window_name` | filter by window title |+| `start_time` | ISO 8601 UTC start time |+| `end_time` | ISO 8601 UTC end time |+| `limit` | max results (default: 50) |+| `offset` | pagination offset |++<Tip>+**event types explained:**+- `text` - aggregated keyboard input (what was typed)+- `click` - mouse clicks with element labels from accessibility APIs+- `app_switch` / `window_focus` - track which apps you used+- `clipboard` - copy/paste operations with content+</Tip>+## example workflows**recall context from earlier:**@@ -119,6 +150,24 @@ the `search-content` tool supports these parameters:> in the browser yesterday about asyncio patterns```+**track what you typed:**+```+> what did I write in Notion this morning? use ui-events+> to find my keyboard input+```++**analyze productivity:**+```+> get my app usage stats for today and tell me which apps+> I spent the most time in+```++**recall clipboard history:**+```+> I copied something important earlier, search clipboard+> events to find it+```+## requirements- screenpipe running on localhost:3030diff --git a/content/docs-mintlify-mig-tmp/cline.mdx b/content/docs-mintlify-mig-tmp/cline.mdxindex 0d27a6c15..ad342107d 100644--- a/content/docs-mintlify-mig-tmp/cline.mdx+++ b/content/docs-mintlify-mig-tmp/cline.mdx@@ -58,9 +58,9 @@ Cline's "Plan" mode works great with screenpipe:screenpipe provides:-- **search-content** - search screen OCR, audio, UI elements-- **pixel-control** - control mouse/keyboard-- **find-elements** / **click-element** - UI automation (macOS)+- **search-content** - search screen OCR, audio transcriptions+- **search-ui-events** - search accessibility data: keyboard input, mouse clicks, app switches, clipboard (macOS)+- **get-ui-event-stats** - get aggregated app usage statistics## requirementsdiff --git a/content/docs-mintlify-mig-tmp/continue.mdx b/content/docs-mintlify-mig-tmp/continue.mdxindex 32a646bd0..bc982fae9 100644--- a/content/docs-mintlify-mig-tmp/continue.mdx+++ b/content/docs-mintlify-mig-tmp/continue.mdx@@ -89,9 +89,10 @@ Continue also supports context providers. you can add screenpipe as a custom convia MCP, Continue gets access to:-- **search-content** - search screen OCR, audio, UI elements-- **pixel-control** - mouse/keyboard control-- **UI automation tools** - find and click elements (macOS)+- **search-content** - search screen OCR and audio transcriptions+- **search-ui-events** - search accessibility data: keyboard input, clicks, app switches, clipboard (macOS)+- **get-ui-event-stats** - aggregated app usage statistics+- **export-video** - create video exports from screen recordings## requirementsdiff --git a/content/docs-mintlify-mig-tmp/gemini-cli.mdx b/content/docs-mintlify-mig-tmp/gemini-cli.mdxindex a2411df0f..3ae0538b5 100644--- a/content/docs-mintlify-mig-tmp/gemini-cli.mdx+++ b/content/docs-mintlify-mig-tmp/gemini-cli.mdx@@ -49,10 +49,10 @@ geminiscreenpipe provides these MCP tools to Gemini:-- **search-content** - search screen OCR, audio transcriptions, UI elements-- **pixel-control** - control mouse and keyboard (macOS)-- **find-elements** - find UI elements by role (macOS)-- **click-element** - click UI elements (macOS)+- **search-content** - search screen OCR, audio transcriptions+- **search-ui-events** - search accessibility data: keyboard input, mouse clicks, app switches, clipboard (macOS)+- **get-ui-event-stats** - get aggregated UI event statistics by app+- **export-video** - create video exports from screen recordings## example workflowsdiff --git a/content/docs-mintlify-mig-tmp/mcp-server.mdx b/content/docs-mintlify-mig-tmp/mcp-server.mdxindex 4aab64e86..ab7e1d12a 100644--- a/content/docs-mintlify-mig-tmp/mcp-server.mdx+++ b/content/docs-mintlify-mig-tmp/mcp-server.mdx@@ -144,7 +144,7 @@ to use with Cursor:### search-content (all platforms)-search through recorded screen content, audio transcriptions, and UI elements:+search through recorded screen content (OCR) and audio transcriptions:| parameter | type | description ||-----------|------|-------------|@@ -162,6 +162,41 @@ search through recorded screen content, audio transcriptions, and UI elements:| `speaker_ids` | string | comma-separated speaker IDs for audio filtering (e.g., `1,2,3`) || `speaker_name` | string | filter audio by speaker name (case-insensitive partial match) |+### search-ui-events (macOS)++search UI input events captured via accessibility APIs. this is the third data modality alongside vision and audio.++| parameter | type | description |+|-----------|------|-------------|+| `q` | string | search text content, app name, window title |+| `event_type` | string | `click`, `text`, `scroll`, `key`, `app_switch`, `window_focus`, `clipboard` |+| `app_name` | string | filter by application |+| `window_name` | string | filter by window title |+| `start_time` | string | ISO 8601 UTC start time |+| `end_time` | string | ISO 8601 UTC end time |+| `limit` | integer | max results (default: 50) |+| `offset` | integer | pagination offset |++**event types:**+- `text` - aggregated keyboard input (what was typed)+- `click` - mouse clicks with accessibility element context+- `app_switch` / `window_focus` - app and window switching+- `clipboard` - copy/paste operations with content+- `scroll` - scroll events with delta values++<Note>+UI events require macOS with Accessibility permissions and "UI Events" enabled in screenpipe settings.+</Note>++### get-ui-event-stats (macOS)++get aggregated statistics of UI events by app and event type for productivity analysis:++| parameter | type | description |+|-----------|------|-------------|+| `start_time` | string | ISO 8601 UTC start time |+| `end_time` | string | ISO 8601 UTC end time |+### export-videocreate video exports from screen recordings for a specific time range:@@ -181,6 +216,10 @@ try these in Claude or Cursor:- "show me what was on my screen in VS Code yesterday"- "export a video of my screen from 10am to 11am today"- "find what John said in our meeting about the API"+- "what did I type in Slack today?" (uses search-ui-events)+- "show me my app usage statistics for the past 3 hours"+- "what did I copy to my clipboard recently?"+- "which apps did I switch between most during my work session?"## testingdiff --git a/content/docs-mintlify-mig-tmp/opencode.mdx b/content/docs-mintlify-mig-tmp/opencode.mdxindex 48709c2de..485a42415 100644--- a/content/docs-mintlify-mig-tmp/opencode.mdx+++ b/content/docs-mintlify-mig-tmp/opencode.mdx@@ -43,7 +43,7 @@ OpenCode uses the same Agent Skills format as Claude Code. files in `.claude/age| skill | description ||-------|-------------|-| `screenpipe-query` | search screen OCR, audio transcriptions, UI elements |+| `screenpipe-query` | search screen OCR, audio transcriptions, and UI events (keyboard input, clicks, app switches, clipboard) || `screenpipe-health` | check status, diagnose issues, verify permissions || `screenpipe-logs` | retrieve and analyze screenpipe logs |diff --git a/content/docs-mintlify-mig-tmp/sdk-reference.mdx b/content/docs-mintlify-mig-tmp/sdk-reference.mdxindex b813aaf9b..38bd74cba 100644--- a/content/docs-mintlify-mig-tmp/sdk-reference.mdx+++ b/content/docs-mintlify-mig-tmp/sdk-reference.mdx@@ -98,6 +98,47 @@ const results = await pipe.queryScreenpipe({})```+### ui events api (accessibility data - macOS)++screenpipe captures UI events via accessibility APIs on macOS. this is the third data modality alongside vision (OCR) and audio.++```typescript+// search UI events via REST API+const response = await fetch('http://localhost:3030/ui-events?' + new URLSearchParams({+ event_type: 'text', // click, text, scroll, key, app_switch, window_focus, clipboard+ app_name: 'Slack', // filter by app+ limit: '50',+ start_time: '2024-03-10T12:00:00Z',+ end_time: '2024-03-10T13:00:00Z',+}));+const data = await response.json();++// each event contains:+// - event_type: click, text, scroll, key, app_switch, window_focus, clipboard+// - timestamp: ISO 8601 timestamp+// - app_name, window_title: context+// - text_content: for text/clipboard events, what was typed/copied+// - x, y: for click events, coordinates+// - element: accessibility element info (label, role) for click events+```++**event types:**+- `text` - aggregated keyboard input (what was typed)+- `click` - mouse clicks with element accessibility labels+- `app_switch` / `window_focus` - app and window changes+- `clipboard` - copy/paste operations with content+- `scroll` - scroll events with delta values++```typescript+// get UI event statistics (app usage analysis)+const statsResponse = await fetch('http://localhost:3030/ui-events/stats?' + new URLSearchParams({+ start_time: '2024-03-10T00:00:00Z',+ end_time: '2024-03-10T23:59:59Z',+}));+const stats = await statsResponse.json();+// returns: [{ app_name, event_type, count }, ...]+```+### common usage patterns#### fetching recent screen activitydiff --git a/screenpipe-integrations/screenpipe-mcp/README.md b/screenpipe-integrations/screenpipe-mcp/README.mdindex 0a981fc01..f4f740567 100644--- a/screenpipe-integrations/screenpipe-mcp/README.md+++ b/screenpipe-integrations/screenpipe-mcp/README.md@@ -64,15 +64,30 @@ npx @modelcontextprotocol/inspector npx screenpipe-mcp## Available Tools-- **search-content** - Search through recorded screen content, audio transcriptions, and UI elements- - Full text search with content type filtering (OCR/Audio/UI)- - Time range and app/window filtering- - Speaker filtering (by ID or name)- - Pagination support--- **export-video** - Export screen recordings as video files- - Specify time range with start/end times- - Configurable FPS for output video+### search-content+Search through recorded screen content (OCR) and audio transcriptions:+- Full text search with content type filtering (OCR/Audio/UI)+- Time range and app/window filtering+- Speaker filtering (by ID or name)+- Pagination support++### search-ui-events (macOS)+Search UI input events captured via accessibility APIs. This is the third data modality alongside vision and audio:+- **Event types**: `click`, `text`, `scroll`, `key`, `app_switch`, `window_focus`, `clipboard`+- Filter by app, window, time range+- `text` events show aggregated keyboard input (what was typed)+- `click` events include accessibility element labels+- `clipboard` events show copy/paste content++### get-ui-event-stats (macOS)+Get aggregated statistics of UI events:+- Event counts grouped by app and event type+- Useful for productivity analysis and app usage tracking++### export-video+Export screen recordings as video files:+- Specify time range with start/end times+- Configurable FPS for output video## Example Queries in Claude@@ -81,6 +96,10 @@ npx @modelcontextprotocol/inspector npx screenpipe-mcp- "Show me what was on my screen in VSCode yesterday"- "Export a video of my screen from 2-3pm today"- "Find what John said in our meeting about the database"+- "What did I type in Slack today?" (uses search-ui-events)+- "Show me my app usage statistics for the past 3 hours"+- "What did I copy to clipboard recently?"+- "Which apps did I switch between most today?"## Requirementsdiff --git a/screenpipe-integrations/screenpipe-mcp/package.json b/screenpipe-integrations/screenpipe-mcp/package.jsonindex ba82636a2..ce9a104f5 100644--- a/screenpipe-integrations/screenpipe-mcp/package.json+++ b/screenpipe-integrations/screenpipe-mcp/package.json@@ -1,6 +1,6 @@{"name": "screenpipe-mcp",- "version": "0.6.0",+ "version": "0.7.0","description": "MCP server for screenpipe - search your screen recordings and audio transcriptions","main": "dist/index.js","bin": {diff --git a/screenpipe-integrations/screenpipe-mcp/src/index.ts b/screenpipe-integrations/screenpipe-mcp/src/index.tsindex e141a989d..576aa626c 100644--- a/screenpipe-integrations/screenpipe-mcp/src/index.ts+++ b/screenpipe-integrations/screenpipe-mcp/src/index.ts@@ -45,7 +45,7 @@ const SCREENPIPE_API = `http://localhost:${port}`;const server = new Server({name: "screenpipe",- version: "0.5.0",+ version: "0.7.0",},{capabilities: {@@ -79,7 +79,7 @@ const BASE_TOOLS: Tool[] = [content_type: {type: "string",enum: ["all", "ocr", "audio", "ui"],- description: "Content type filter. Default: 'all'",+ description: "Content type filter: 'ocr' (screen text), 'audio' (transcriptions), 'ui' (legacy UI monitoring), 'all'. Default: 'all'. For keyboard/mouse/accessibility events, use search-ui-events tool instead.",default: "all",},limit: {@@ -172,6 +172,86 @@ const BASE_TOOLS: Tool[] = [required: ["start_time", "end_time"],},},+ {+ name: "search-ui-events",+ description:+ "Search UI input events captured via accessibility APIs (macOS). " ++ "This is the third modality alongside vision (OCR) and audio. " ++ "Captures: mouse clicks, keyboard text input, scroll events, app/window switches, clipboard operations. " ++ "Events include app context, element info (accessibility labels), and precise timestamps. " ++ "Great for understanding user workflow, what was typed, clicked, or copied.",+ annotations: {+ title: "Search UI Events (Accessibility)",+ readOnlyHint: true,+ },+ inputSchema: {+ type: "object",+ properties: {+ q: {+ type: "string",+ description: "Search query for text content, app name, window title. Optional - omit to return recent events.",+ },+ event_type: {+ type: "string",+ enum: ["click", "text", "scroll", "key", "app_switch", "window_focus", "clipboard"],+ description: "Filter by event type. 'text' = aggregated keyboard input, 'click' = mouse clicks with element context, 'app_switch'/'window_focus' = app usage tracking, 'clipboard' = copy/paste events.",+ },+ app_name: {+ type: "string",+ description: "Filter by application name (e.g., 'Google Chrome', 'Slack', 'Code')",+ },+ window_name: {+ type: "string",+ description: "Filter by window title",+ },+ start_time: {+ type: "string",+ format: "date-time",+ description: "ISO 8601 UTC start time (e.g., 2024-01-15T10:00:00Z)",+ },+ end_time: {+ type: "string",+ format: "date-time",+ description: "ISO 8601 UTC end time (e.g., 2024-01-15T18:00:00Z)",+ },+ limit: {+ type: "integer",+ description: "Max results. Default: 50",+ default: 50,+ },+ offset: {+ type: "integer",+ description: "Skip N results for pagination. Default: 0",+ default: 0,+ },+ },+ },+ },+ {+ name: "get-ui-event-stats",+ description:+ "Get aggregated statistics of UI events by app and event type. " ++ "Useful for understanding app usage patterns, productivity analysis, or finding which apps were used most.",+ annotations: {+ title: "UI Event Statistics",+ readOnlyHint: true,+ },+ inputSchema: {+ type: "object",+ properties: {+ start_time: {+ type: "string",+ format: "date-time",+ description: "ISO 8601 UTC start time for stats period",+ },+ end_time: {+ type: "string",+ format: "date-time",+ description: "ISO 8601 UTC end time for stats period",+ },+ },+ },+ },];// List tools handler@@ -245,18 +325,20 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {mimeType: "text/markdown",text: `# Screenpipe Search Guide+## Three Data Modalities++Screenpipe captures three types of data:+1. **Vision (OCR)** - Screen text from screenshots+2. **Audio** - Transcribed speech from microphone/system audio+3. **UI Events (Accessibility)** - Keyboard input, mouse clicks, app switches, clipboard (macOS)+## Quick Start- **Get recent activity**: Call search-content with no parameters- **Search text**: \`{"q": "search term", "content_type": "ocr"}\`-- **Time filter**: Use start_time/end_time with ISO 8601 UTC timestamps+- **Get keyboard input**: Use search-ui-events with \`event_type: "text"\`+- **Track app usage**: Use get-ui-event-stats for aggregated data-## Content Types-- \`ocr\`: Screen text (what you see)-- \`audio\`: Transcribed speech-- \`ui\`: UI element interactions-- \`all\`: Everything (default)--## Key Parameters+## search-content (Vision + Audio)| Parameter | Description | Default ||-----------|-------------|---------|| q | Search query | (none - returns all) |@@ -267,11 +349,27 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {| app_name | Filter by app | (no filter) || include_frames | Include screenshots | false |+## search-ui-events (Accessibility Data)+| Parameter | Description | Default |+|-----------|-------------|---------|+| q | Search text content, app, window | (none) |+| event_type | click/text/scroll/key/app_switch/window_focus/clipboard | (all types) |+| app_name | Filter by application | (no filter) |+| limit | Max results | 50 |++### Event Types+- \`text\`: Aggregated keyboard input (what was typed)+- \`click\`: Mouse clicks with element context (accessibility labels)+- \`app_switch\`: When user switched applications+- \`window_focus\`: When window focus changed+- \`clipboard\`: Copy/paste operations+- \`scroll\`: Scroll events with delta values+## Tips1. Read screenpipe://context first to get current timestamps-2. Omit \`q\` to get all content (useful for "what was I doing?")-3. Use \`limit: 50-100\` for comprehensive searches-4. Combine app_name + time filters for focused results`,+2. Use search-ui-events for "what did I type?" queries+3. Use get-ui-event-stats to understand app usage patterns+4. Combine search-content (what was on screen) with search-ui-events (what was done)`,},],};@@ -738,6 +836,136 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {}}+ case "search-ui-events": {+ const params = new URLSearchParams();+ for (const [key, value] of Object.entries(args)) {+ if (value !== null && value !== undefined) {+ // Map event_type to the API parameter+ params.append(key, String(value));+ }+ }++ const response = await fetchAPI(`/ui-events?${params.toString()}`);+ if (!response.ok) {+ throw new Error(`HTTP error: ${response.status}`);+ }++ const data = await response.json();+ const events = data.data || [];+ const pagination = data.pagination || {};++ if (events.length === 0) {+ return {+ content: [+ {+ type: "text",+ text: "No UI events found. This feature requires:\n" ++ "1. macOS with Accessibility permissions granted\n" ++ "2. UI Events enabled in screenpipe settings\n" ++ "Try: broader time range or different event_type filter.",+ },+ ],+ };+ }++ const formattedEvents: string[] = [];+ for (const event of events) {+ const parts = [+ `[${event.event_type?.toUpperCase() || "?"}]`,+ event.app_name || "?",+ event.window_title ? `| ${event.window_title}` : "",+ ];++ let details = "";+ if (event.event_type === "text" && event.text_content) {+ details = `Text: "${event.text_content}"`;+ } else if (event.event_type === "click") {+ details = `Click at (${event.x || 0}, ${event.y || 0})`;+ if (event.element?.label) {+ details += ` on "${event.element.label}"`;+ }+ } else if (event.event_type === "clipboard" && event.text_content) {+ details = `Clipboard: "${event.text_content.substring(0, 100)}${event.text_content.length > 100 ? "..." : ""}"`;+ } else if (event.event_type === "app_switch" || event.event_type === "window_focus") {+ details = `Switched to: ${event.app_name}${event.window_title ? ` - ${event.window_title}` : ""}`;+ } else if (event.event_type === "scroll") {+ details = `Scroll: dx=${event.delta_x || 0}, dy=${event.delta_y || 0}`;+ }++ formattedEvents.push(+ `${parts.join(" ")}\n` ++ `${event.timestamp || ""}\n` ++ `${details}`+ );+ }++ const header = `UI Events: ${events.length}/${pagination.total || "?"}` ++ (pagination.total > events.length ? ` (use offset=${(pagination.offset || 0) + events.length} for more)` : "");++ return {+ content: [+ {+ type: "text",+ text: header + "\n\n" + formattedEvents.join("\n---\n"),+ },+ ],+ };+ }++ case "get-ui-event-stats": {+ const params = new URLSearchParams();+ if (args.start_time) params.append("start_time", String(args.start_time));+ if (args.end_time) params.append("end_time", String(args.end_time));++ const response = await fetchAPI(`/ui-events/stats?${params.toString()}`);+ if (!response.ok) {+ throw new Error(`HTTP error: ${response.status}`);+ }++ const stats = await response.json();++ if (!stats || stats.length === 0) {+ return {+ content: [+ {+ type: "text",+ text: "No UI event statistics available. UI Events may not be enabled or no events have been captured yet.",+ },+ ],+ };+ }++ // Group by app+ const byApp: Record<string, { app: string; events: Record<string, number>; total: number }> = {};+ for (const stat of stats) {+ const app = stat.app_name || "Unknown";+ if (!byApp[app]) {+ byApp[app] = { app, events: {}, total: 0 };+ }+ byApp[app].events[stat.event_type] = stat.count;+ byApp[app].total += stat.count;+ }++ // Sort by total events+ const sorted = Object.values(byApp).sort((a, b) => b.total - a.total);++ const lines = sorted.map(({ app, events, total }) => {+ const eventDetails = Object.entries(events)+ .map(([type, count]) => `${type}: ${count}`)+ .join(", ");+ return `${app}: ${total} events (${eventDetails})`;+ });++ return {+ content: [+ {+ type: "text",+ text: `UI Event Statistics:\n\n${lines.join("\n")}`,+ },+ ],+ };+ }+default:throw new Error(`Unknown tool: ${name}`);}