Skip to content

feat: add optional types ocr and metadata for search image#125

Merged
silloi merged 2 commits intomainfrom
feature/expand-metadata-of-search
Feb 9, 2026
Merged

feat: add optional types ocr and metadata for search image#125
silloi merged 2 commits intomainfrom
feature/expand-metadata-of-search

Conversation

@silloi
Copy link
Member

@silloi silloi commented Feb 9, 2026

Summary

This PR adds OCR (Optical Character Recognition) and metadata fields to the Search API response. Previously, the gyazo_search tool only returned basic image information, but now it includes OCR text extraction results and metadata information that are available in the actual Gyazo Search API.

Changes

API Documentation

  • Updated gyazo_api.md to document the correct Search API response structure
  • Added field descriptions for ocr, metadata, and alt_text
  • Clarified field presence behavior:
    • ocr: Conditionally present (only included when OCR data is available)
    • metadata: Always present in response (as long as owned)
    • alt_text: Always present in response

Type Definitions

  • Modified SearchedGyazoImage type in types.ts:
    • Added optional ocr field with locale and description properties
    • Changed metadata from optional to required (always present in API response)
    • Metadata includes: app, title, url, desc, original_title, original_url

Implementation

  • Updated handleGyazoSearch handler in tools.ts to include:
    • ocr field (conditionally added only when present in API response)
    • metadata field (always included as long as owned)
    • alt_text field (always included)

Verification

Verified the actual Gyazo Search API behavior through testing:

  • Confirmed that ocr field is not present in the response object when OCR data is unavailable (returns undefined when accessed)
  • Confirmed that metadata and alt_text fields are always present in response objects for owned images, though individual property values may be null or empty strings

Benefits

  • Users can now search for images and access OCR text content directly through the MCP tool
  • Image metadata (app, title, URL, description) is available for better context
  • Enables more sophisticated image retrieval workflows based on text content and metadata

@silloi silloi requested a review from Copilot February 9, 2026 08:08
@silloi silloi self-assigned this Feb 9, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds optional ocr and metadata fields to Gyazo Search image results across documentation, TypeScript types, and the gyazo_search handler so consumers can retrieve OCR text and rich metadata in a single call.

Changes:

  • Updated SearchedGyazoImage type to include optional ocr and metadata
  • Modified gyazo_search results to pass through ocr and metadata
  • Refreshed gyazo_api.md Search API example/field descriptions to include ocr and metadata

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/types.ts Extends search image type model with optional ocr and metadata payloads
src/handlers/tools.ts Includes ocr/metadata in the gyazo_search tool output
gyazo_api.md Updates API documentation example + response field list to cover ocr/metadata

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- ocr field is conditionally present (only when OCR data available)
- metadata and alt_text fields are always present in response
@silloi silloi merged commit b6c8239 into main Feb 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments