All skills
mapbox avatar

/mapbox-search-patterns

@f5ae7de official
by mapboxmapbox/mapbox-agent-skills80 stars
17

Expert guidance on choosing the right Mapbox search tool and parameters for geocoding, POI search, and location discovery

Use this Skill: https://skilld.dev/gh/mapbox/mapbox-agent-skills/mapbox-search-patterns

This session only. Nothing lands on disk.

referencesoptimization-combining.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Performance, Combining Tools, and Troubleshooting

Performance Optimization

Minimize API Calls

Pattern: Geocode once, reuse coordinates

// GOOD
1. User enters "Seattle"
2. Geocode "Seattle" → (lng, lat)
3. Use those coordinates for multiple category searches
4. Cache coordinates for session

// BAD
1. Geocode "Seattle" for coffee search
2. Geocode "Seattle" again for restaurant search
3. Geocode "Seattle" again for hotel search

Set Appropriate Limits

UI Context Recommended Limit
Autocomplete dropdown 5
List view 10
Map view 25
Export/download 25 (or paginate)

Use Offline Tools When Possible

After getting search results:

1. category_search_tool → Get POIs
2. distance_tool (offline) → Calculate distances
3. bearing_tool (offline) → Get directions

Why: Search once (API), then use offline tools for calculations (free, fast)

Combining Search with Other Tools

Search → Distance Calculation

1. category_search_tool({category: "hospital", proximity: user_location})
   → Returns 10 hospitals with coordinates
2. distance_tool(user_location, each_hospital)
   → Calculate exact distances offline
3. Sort by distance

Search → Directions

1. search_and_geocode_tool({q: "Space Needle"})
   → Get destination coordinates
2. directions_tool({from: user_location, to: space_needle_coords})
   → Get turn-by-turn directions

Search → Isochrone → Containment Check

1. search_and_geocode_tool({q: "warehouse"})
   → Get warehouse coordinates
2. isochrone_tool({coordinates: warehouse, time: 30, profile: "driving"})
   → Get 30-minute delivery zone polygon
3. point_in_polygon_tool(customer_address, delivery_zone)
   → Check if customer is in delivery zone

Search → Static Map Visualization

1. category_search_tool({category: "restaurant", limit: 10})
   → Get restaurant coordinates
2. static_map_image_tool({
     markers: restaurant_coordinates,
     auto_fit: true
   })
   → Create map image showing all restaurants

Handling No Results

If category_search returns no results:

Possible reasons:

  1. Invalid category → Use resource_reader_tool with mapbox://categories to see valid categories
  2. Too restrictive bbox → Expand area or use proximity instead
  3. No POIs in area → Try broader category or remove spatial filters
  4. Wrong country filter → Check country codes

Example recovery:

1. category_search_tool({category: "taco"}) → No results
2. Check: Is "taco" a valid category?
   → Use category_list_tool → See "mexican_restaurant" is valid
3. Retry: category_search_tool({category: "mexican_restaurant"}) → Success

If search_and_geocode returns no results:

Possible reasons:

  1. Typo in query → Retry with auto_complete: true
  2. Too specific → Broaden search (remove address numbers, try nearby city)
  3. Wrong types filter → Remove or expand types
  4. Not a recognized place → Check spelling, try alternative names

Category List Resource

Get valid categories: Use resource_reader_tool or category_list_tool

resource_reader_tool({uri: "mapbox://categories"})

Returns: All valid category IDs (e.g., "restaurant", "hotel", "gas_station")

When to use:

  • User enters free-text category
  • Need to map user terms to Mapbox categories
  • Validating category before search

Example mapping:

  • User: "places to eat" → Category: "restaurant"
  • User: "gas" → Category: "gas_station"
  • User: "lodging" → Category: "hotel"

Integration with Other Skills

Works with:

  • mapbox-geospatial-operations: After search, use offline distance/bearing calculations
  • mapbox-web-integration-patterns: Display search results on map in web app
  • mapbox-token-security: Ensure search requests use properly scoped tokens

Resources

Source: SKILL.md on GitHub

No alerts17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The Mapbox Search Patterns skill is a comprehensive documentation package providing guidance on using Mapbox search tools. It contains only instructional content, best practices, and evaluation examples, with no executable code or security risks identified.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer6mo

    1 file scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at f5ae7de. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 9 hours ago.

Activeupdated 2 months ago
  • mapbox
  • geocoding
  • search
  • poi
  • location-discovery
  • reverse-geocoding
  • spatial-search
  • api-patterns

README badge

README badge for mapbox/mapbox-agent-skills/mapbox-search-patterns

Provides decision guidance for choosing between Mapbox's search_and_geocode_tool, category_search_tool, and reverse_geocode_tool based on query type, plus parameter optimization for proximity, bbox, country filtering, and result limits. Use this skill when building location search features to select the right tool and avoid common mistakes like forgetting proximity or using category search for brand names.

Generated from the current SKILL.md.

Should I use search_and_geocode_tool or category_search_tool for a brand like Starbucks?
Use search_and_geocode_tool for brand names. category_search_tool is for generic place types like 'coffee shops' or 'restaurants', not specific brands.
When should I use proximity vs bbox for spatial filtering?
Use proximity to bias results toward a location while allowing flexibility (best for 'near me' queries). Use bbox for a hard boundary when results must stay within a defined area, like a specific neighborhood.
Do I need to set proximity for local searches?
Yes. Without proximity, bbox, or country constraints, results are determined by IP-based location or global relevance, not the user's actual location.
What does the limit parameter do and when should I use it?
limit controls how many results to return (1-25, default 10) and only applies to category_search_tool. Use lower limits (5) for UI dropdowns and higher limits (25) for comprehensive lists or maps.
Should I request ETA (travel time) in every search?
No. ETA adds API cost and should only be included when the user explicitly asks about travel time or distance. Requesting it unnecessarily wastes quota.

Generated from the current SKILL.md. These answers refresh after source changes.