Skip to content

Commit 4c540e2

Browse files
Add metadata field to SearchAndGeocodeTool schema
The Mapbox Search Box API can return metadata (including primary_photo and Japanese reading information) for various feature types in forward geocoding results. Currently, SearchAndGeocodeTool.output.schema.ts doesn't include a metadata field, which could lead to validation errors when the API returns this data. This fix adds the metadata field with the same structure used in CategorySearchTool (fixed in PR #77): - primary_photo: Accepts both string and array of strings - reading: Optional Japanese reading information (ja_kana, ja_latin) This prevents validation failures when the API returns metadata fields. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent 617f562 commit 4c540e2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ const SearchBoxFeaturePropertiesSchema = z
100100
brand_id: z.union([z.string(), z.array(z.string())]).optional(),
101101
external_ids: z.record(z.string()).optional(),
102102

103+
// Metadata schema for additional feature information
104+
metadata: z
105+
.object({
106+
// API sometimes returns string, sometimes array - accept both
107+
primary_photo: z.union([z.string(), z.array(z.string())]).optional(),
108+
reading: z
109+
.object({
110+
ja_kana: z.string().optional(),
111+
ja_latin: z.string().optional()
112+
})
113+
.optional()
114+
})
115+
.optional(),
116+
103117
// Additional metadata
104118
maki: z.string().optional(),
105119
operational_status: z.string().optional(),

0 commit comments

Comments
 (0)