From c8382c04b59c19fa130631bedd045e685ee9bee1 Mon Sep 17 00:00:00 2001 From: Antigravity AI Date: Sun, 31 May 2026 17:13:25 +1200 Subject: [PATCH] fix(27): correct investigate-prompt tool examples and two inaccurate tool descriptions Code review (27-REVIEW.md) found the Phase 26 investigate prompt template gave schema-invalid example calls that an agent would follow literally: - geocode -> geocode_location (correct tool name) - toggle_layer({pluginId,visible}) -> ({layerId,enabled}) - get_entities_in_region({lat,lon,radiusKm}) -> bounding box ({north,south,east,west}) - get_entity_details({entityId}) -> ({pluginId,entityId}) Plus two descriptions that over-promised handler behavior: - get_plugin_data: capturedAt is only present when data streamed - remove_favorite: throws/returns failure on missing record, not silent success Resolves CR-01, CR-02, WR-01, WR-02 from the Phase 27 code review. --- src/app/api/mcp/favoritesTools.ts | 2 +- src/lib/mcp/server.ts | 8 ++++---- src/lib/mcp/tools.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/api/mcp/favoritesTools.ts b/src/app/api/mcp/favoritesTools.ts index 5c7a1691..b4ca1c18 100644 --- a/src/app/api/mcp/favoritesTools.ts +++ b/src/app/api/mcp/favoritesTools.ts @@ -156,7 +156,7 @@ export function registerFavoritesTools( description: "Delete a bookmarked entity from the authenticated user's favorites. " + "Pair with list_favorites to find the correct entityId before removing. " + - "Limitations: deletes by entityId; silently succeeds if the entity was already removed. " + + "Limitations: deletes by exact entityId; removing an entity that is not currently a favorite returns 'remove_favorite failed' (call list_favorites first to confirm it exists). " + "Parameters: entityId (string, required). " + "Output: 'Removed favorite: '. " + "Example: remove_favorite({ entityId: 'AFR123' }).", diff --git a/src/lib/mcp/server.ts b/src/lib/mcp/server.ts index 9f3df933..2a7b44d7 100644 --- a/src/lib/mcp/server.ts +++ b/src/lib/mcp/server.ts @@ -205,7 +205,7 @@ export async function registerOrientationPrompts( `INVESTIGATION WORKFLOW${place ? `: ${place.toUpperCase()}` : ""}`, "", `Step 1 -- Geocode the target`, - ` Call: geocode({ query: "${target}" })`, + ` Call: geocode_location({ query: "${target}" })`, ` Result: latitude, longitude, display name.`, ` Stop if no result is returned -- the place name may be misspelled or too ambiguous.`, "", @@ -219,15 +219,15 @@ export async function registerOrientationPrompts( ` Then call: pan_globe({ lat, lon, alt: 500000 }) to fly to the geocoded coordinates.`, "", `Step 4 -- Toggle relevant layers`, - ` Call: toggle_layer({ pluginId: "", visible: true }) for each plugin relevant to your query.`, + ` Call: toggle_layer({ layerId: "", enabled: true }) for each plugin layer relevant to your query.`, ` Wait a moment for the plugin to stream data before querying.`, "", `Step 5 -- Query entities in the region`, - ` Call: get_entities_in_region({ lat, lon, radiusKm: 50 }) or the plugin-specific tool if available.`, + ` Call: get_entities_in_region({ north, south, east, west }) -- a bounding box around the geocoded coordinates -- or the plugin-specific tool if available.`, ` An empty result means the plugin is not streaming data for this region right now -- that is normal.`, "", `Step 6 -- Drill into specific entities`, - ` Call: get_entity_details({ entityId: "" }) for any entity of interest.`, + ` Call: get_entity_details({ pluginId: "", entityId: "" }) for any entity of interest.`, ` Call: focus_entity({ entityId: "" }) to centre the camera on it.`, ].join("\n"); diff --git a/src/lib/mcp/tools.ts b/src/lib/mcp/tools.ts index 932efc76..7d6b1d24 100644 --- a/src/lib/mcp/tools.ts +++ b/src/lib/mcp/tools.ts @@ -153,7 +153,7 @@ export function registerDataQueryTools(server: McpServer): void { "get_plugin_data", { description: - "Full data snapshot returning all current entities for one plugin by pluginId. Use to bulk-read a plugin's live state. Limitation: an empty result (count 0) has two distinct causes -- plugin not loaded or not streaming yet (re-call tools/list after the plugin loads), OR no entities matched (plugin loaded but empty); a future emptyReason field will distinguish these. Includes capturedAt timestamp. Example: get_plugin_data({ pluginId: 'earthquakes' })", + "Full data snapshot returning all current entities for one plugin by pluginId. Use to bulk-read a plugin's live state. Limitation: an empty result (count 0) has two distinct causes -- plugin not loaded or not streaming yet (re-call tools/list after the plugin loads), OR no entities matched (plugin loaded but empty); a future emptyReason field will distinguish these. Includes a capturedAt timestamp when the plugin has streamed data (absent for the not-loaded case). Example: get_plugin_data({ pluginId: 'earthquakes' })", inputSchema: { pluginId: z.string().describe("The plugin identifier"), },