Skip to content

Fix agent places card map link and AI synthesis hallucinating no results#172

Merged
asim merged 2 commits intomainfrom
copilot/fix-cafe-listings-query-issues
Mar 2, 2026
Merged

Fix agent places card map link and AI synthesis hallucinating no results#172
asim merged 2 commits intomainfrom
copilot/fix-cafe-listings-query-issues

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

Two bugs in the agent's places tool flow: the AI synthesis would claim no results despite the places card showing them, and the "Open map" link pointed to the generic /places page requiring a new paid API call.

Root causes & fixes

AI says "couldn't find results" when results exist

The synthesizer RAG context was receiving raw JSON ({"results":[...],"count":5}), which the LLM failed to interpret reliably. New formatPlacesResult() pre-converts the JSON to readable text before passing to the synthesizer:

Found 3 place(s) matching "cafe" near Hampton, UK:
1. Hampton Cafe (cafe) — 12 High St, Hampton
2. The Tea Room (cafe) — 5 River Rd, Hampton

Map link goes to generic /places (triggers another paid search)

renderPlacesCard previously linked to /places unconditionally. Now placesMapURL() builds a deterministic Google Maps URL directly from the original tool args — no server round-trip, no additional cost:

  • q + near/addresshttps://www.google.com/maps/search/?api=1&query=cafe+Hampton+UK
  • q only → query-only search URL
  • Fallback → coordinate-based URL from first result's lat/lon
  • Last resort → /places

Structural changes

  • toolResult struct gains Args map[string]any so tool call arguments flow through to card renderers
  • placeItem gains Lat/Lon fields for the coordinate fallback
  • renderResultCard / renderPlacesCard updated to accept and use args

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: asim <17530+asim@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues with cafe listings query for Hampton, UK Fix agent places card map link and AI synthesis hallucinating no results Mar 2, 2026
Copilot finished work on behalf of asim March 2, 2026 20:17
@asim asim marked this pull request as ready for review March 2, 2026 20:20
@asim asim merged commit c4bc45b into main Mar 2, 2026
@asim asim deleted the copilot/fix-cafe-listings-query-issues branch March 2, 2026 20:21
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.

2 participants