Add extract_screen_text tool (Vision OCR + optional visual summary)#6
Open
grohith327 wants to merge 1 commit into
Open
Add extract_screen_text tool (Vision OCR + optional visual summary)#6grohith327 wants to merge 1 commit into
grohith327 wants to merge 1 commit into
Conversation
Capture the active display and extract visible text via macOS Vision OCR, returning structured JSON (text, line_count, average_confidence, screenshot_path). When include_visual_summary=true, additionally request a macOS 27 Foundation Models summary, degrading gracefully to OCR-only with a visual_error when unavailable. Ported from the sibling branch feat/extract-screen-text, with the undefined OCRTool() reference in the Foundation Models path removed (it broke compilation on macOS 27 toolchains) and the empty package.json/package-lock.json cruft dropped. Wires the tool into server.py and documents it in the altic-studio skill and README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
PR NotesHTML preview: https://altic-mcp-pr-6.vercel.app Source commit: Adds the extract_screen_text MCP tool (Vision OCR + optional macOS 27 Foundation Models visual summary), ported from a sibling branch with a Swift compile-bug fix. 39 tests pass; Swift type-checks clean on macOS 27. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
extract_screen_textMCP tool: capture the active display and extract its visible text with macOS Vision OCR, returning structured JSON (text,line_count,average_confidence,screenshot_path). Wheninclude_visual_summary=true, it additionally requests a macOS 27 Foundation Models visual summary, degrading gracefully to OCR-only with avisual_errorwhen that capability is unavailable.Ported from the sibling branch
feat/extract-screen-textwith two intentional deviations:OCRTool()reference in the Foundation Models path (LanguageModelSession(model: model, tools: [OCRTool()])→LanguageModelSession(model: model)), which broke compilation on macOS 27 toolchains.package.json/package-lock.json(this is a Python/uv project).The
altic-studioskill (new Mode B2) and README are updated so the model knows when and how to use the tool.Changes
tools/screen_text.py(new) — Python wrapper (OCR + optional FM summary, JSON output,max_charstruncation)tools/scripts/extract-screen-text.swift(new) — ScreenCaptureKit capture + Vision OCR + gated macOS 27 FM summaryskills/altic-studio/scripts/extract-screen-text.swift(new) — identical mirrortests/test_screen_text.py(new) — 7 unit testsserver.py,SKILL.md,scripts/README.md,README.md— registration + docsTest plan
uv run pytest tests/test_screen_text.py -q→ 7 passeduv run pytest -q(full suite) → 39 passedimport serverconfirmsextract_screen_textis registeredswiftc -typecheck tools/scripts/extract-screen-text.swift→ exit 0 on macOS 27 (FoundationModels branch compiled — confirms theOCRTool()fix)