feat: add optional types ocr and metadata for search image#125
Merged
Conversation
There was a problem hiding this comment.
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
SearchedGyazoImagetype to include optionalocrandmetadata - Modified
gyazo_searchresults to pass throughocrandmetadata - Refreshed
gyazo_api.mdSearch API example/field descriptions to includeocrandmetadata
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
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
This PR adds OCR (Optical Character Recognition) and metadata fields to the Search API response. Previously, the
gyazo_searchtool 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
ocr,metadata, andalt_textocr: Conditionally present (only included when OCR data is available)metadata: Always present in response (as long as owned)alt_text: Always present in responseType Definitions
SearchedGyazoImagetype in types.ts:ocrfield withlocaleanddescriptionpropertiesmetadatafrom optional to required (always present in API response)app,title,url,desc,original_title,original_urlImplementation
handleGyazoSearchhandler in tools.ts to include:ocrfield (conditionally added only when present in API response)metadatafield (always included as long as owned)alt_textfield (always included)Verification
Verified the actual Gyazo Search API behavior through testing:
ocrfield is not present in the response object when OCR data is unavailable (returnsundefinedwhen accessed)metadataandalt_textfields are always present in response objects for owned images, though individual property values may benullor empty stringsBenefits