+
Elevation Information (Mapbox)
+
Elevation: {elevation} meters
+ {mapUrl && (
+
+
+
+ )}
+
+ );
+};
diff --git a/dev.log b/dev.log
new file mode 100644
index 00000000..59e3b892
--- /dev/null
+++ b/dev.log
@@ -0,0 +1 @@
+$ next dev --turbo
diff --git a/jules-scratch/verification/verify_elevation.py b/jules-scratch/verification/verify_elevation.py
new file mode 100644
index 00000000..f85be4ae
--- /dev/null
+++ b/jules-scratch/verification/verify_elevation.py
@@ -0,0 +1,29 @@
+import re
+from playwright.sync_api import Playwright, sync_playwright, expect
+
+def run(playwright: Playwright) -> None:
+ browser = playwright.chromium.launch(headless=True)
+ context = browser.new_context()
+ page = context.new_page()
+ page.goto("http://localhost:3000/")
+
+ # Wait for the loading overlay to disappear
+ loading_overlay = page.locator('div[class*="z-[9999]"]')
+ expect(loading_overlay).to_be_hidden(timeout=60000)
+
+ # Use the correct placeholder text: "Explore"
+ input_field = page.get_by_placeholder("Explore")
+ expect(input_field).to_be_visible(timeout=30000)
+ expect(input_field).to_be_enabled(timeout=30000)
+
+ input_field.click()
+ input_field.fill("what is the elevation of mount everest at latitude 27.9881 and longitude 86.9250?")
+ page.get_by_role("button", name="Send message").click()
+ expect(page.get_by_text("Elevation Information (Mapbox)")).to_be_visible(timeout=90000)
+ page.screenshot(path="jules-scratch/verification/elevation-display.png")
+
+ context.close()
+ browser.close()
+
+with sync_playwright() as playwright:
+ run(playwright)
diff --git a/lib/agents/tools/elevation.tsx b/lib/agents/tools/elevation.tsx
new file mode 100644
index 00000000..a25d92e5
--- /dev/null
+++ b/lib/agents/tools/elevation.tsx
@@ -0,0 +1,94 @@
+/**
+ * Elevation tool to fetch elevation data for a given location using Mapbox Tilequery API.
+ */
+import { createStreamableUI, createStreamableValue } from 'ai/rsc';
+import { BotMessage } from '@/components/message';
+import { z } from 'zod';
+
+// Define the schema for the elevation tool's parameters
+export const elevationQuerySchema = z.object({
+ latitude: z.number().describe('The latitude of the location.'),
+ longitude: z.number().describe('The longitude of the location.'),
+ includeMap: z.boolean().optional().default(true).describe('Whether to include a map preview.'),
+});
+
+// Main elevation tool executor
+export const elevationTool = ({ uiStream }: { uiStream: ReturnType