@haivx/tripmind-maps-mcp 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +226 -0
  2. package/build/index.d.ts +3 -0
  3. package/build/index.d.ts.map +1 -0
  4. package/build/index.js +80 -0
  5. package/build/index.js.map +1 -0
  6. package/build/tools/directions.d.ts +44 -0
  7. package/build/tools/directions.d.ts.map +1 -0
  8. package/build/tools/directions.js +54 -0
  9. package/build/tools/directions.js.map +1 -0
  10. package/build/tools/distance-matrix.d.ts +41 -0
  11. package/build/tools/distance-matrix.d.ts.map +1 -0
  12. package/build/tools/distance-matrix.js +59 -0
  13. package/build/tools/distance-matrix.js.map +1 -0
  14. package/build/tools/geocode.d.ts +51 -0
  15. package/build/tools/geocode.d.ts.map +1 -0
  16. package/build/tools/geocode.js +90 -0
  17. package/build/tools/geocode.js.map +1 -0
  18. package/build/tools/place-details.d.ts +41 -0
  19. package/build/tools/place-details.d.ts.map +1 -0
  20. package/build/tools/place-details.js +57 -0
  21. package/build/tools/place-details.js.map +1 -0
  22. package/build/tools/search-places.d.ts +50 -0
  23. package/build/tools/search-places.d.ts.map +1 -0
  24. package/build/tools/search-places.js +57 -0
  25. package/build/tools/search-places.js.map +1 -0
  26. package/build/tools/timezone.d.ts +41 -0
  27. package/build/tools/timezone.d.ts.map +1 -0
  28. package/build/tools/timezone.js +47 -0
  29. package/build/tools/timezone.js.map +1 -0
  30. package/build/types.d.ts +107 -0
  31. package/build/types.d.ts.map +1 -0
  32. package/build/types.js +2 -0
  33. package/build/types.js.map +1 -0
  34. package/build/utils/cache.d.ts +21 -0
  35. package/build/utils/cache.d.ts.map +1 -0
  36. package/build/utils/cache.js +41 -0
  37. package/build/utils/cache.js.map +1 -0
  38. package/build/utils/google-client.d.ts +83 -0
  39. package/build/utils/google-client.d.ts.map +1 -0
  40. package/build/utils/google-client.js +330 -0
  41. package/build/utils/google-client.js.map +1 -0
  42. package/build/utils/rate-limiter.d.ts +25 -0
  43. package/build/utils/rate-limiter.d.ts.map +1 -0
  44. package/build/utils/rate-limiter.js +41 -0
  45. package/build/utils/rate-limiter.js.map +1 -0
  46. package/package.json +57 -0
@@ -0,0 +1,90 @@
1
+ import { z } from "zod";
2
+ import { cache } from "../utils/cache.js";
3
+ import { geocode as googleGeocode } from "../utils/google-client.js";
4
+ const TTL_MS = 30 * 24 * 60 * 60 * 1000; // 30 days
5
+ export const toolName = "maps_geocode";
6
+ /** Input schema shape for the maps_geocode tool. */
7
+ export const inputSchema = {
8
+ address: z
9
+ .string()
10
+ .optional()
11
+ .describe("Address or landmark to geocode, e.g. 'Tokyo Tower' or '1-1 Marunouchi, Tokyo'"),
12
+ latitude: z
13
+ .number()
14
+ .optional()
15
+ .describe("Latitude for reverse geocoding"),
16
+ longitude: z
17
+ .number()
18
+ .optional()
19
+ .describe("Longitude for reverse geocoding"),
20
+ language: z
21
+ .string()
22
+ .optional()
23
+ .describe("Response language code, e.g. 'en', 'ja', 'vi'. Default: 'en'"),
24
+ };
25
+ /** Tool registration config for McpServer.registerTool(). */
26
+ export const toolConfig = {
27
+ title: "Geocode Address",
28
+ description: "Convert an address or landmark name to GPS coordinates (forward geocoding), or convert coordinates to an address (reverse geocoding). Use this for placing pins on maps or finding where a place is located.",
29
+ inputSchema,
30
+ annotations: {
31
+ readOnlyHint: true,
32
+ destructiveHint: false,
33
+ openWorldHint: true,
34
+ },
35
+ };
36
+ /**
37
+ * Handler for the maps_geocode tool.
38
+ * Validates that either `address` or both `latitude`+`longitude` are provided,
39
+ * checks the cache, calls Google Geocoding API on miss, and caches the result.
40
+ */
41
+ export async function handler(args) {
42
+ try {
43
+ const hasAddress = Boolean(args.address);
44
+ const hasLatLng = args.latitude !== undefined && args.longitude !== undefined;
45
+ if (!hasAddress && !hasLatLng) {
46
+ return {
47
+ content: [
48
+ {
49
+ type: "text",
50
+ text: JSON.stringify({
51
+ error: "Provide either `address` for forward geocoding, or both `latitude` and `longitude` for reverse geocoding.",
52
+ }),
53
+ },
54
+ ],
55
+ isError: true,
56
+ };
57
+ }
58
+ const cacheKey = hasLatLng
59
+ ? `geocode:latlng:${args.latitude},${args.longitude}:${args.language ?? "en"}`
60
+ : `geocode:address:${(args.address ?? "").toLowerCase().trim()}:${args.language ?? "en"}`;
61
+ const cached = cache.get(cacheKey);
62
+ if (cached) {
63
+ return {
64
+ content: [{ type: "text", text: JSON.stringify(cached) }],
65
+ };
66
+ }
67
+ const results = await googleGeocode({
68
+ address: args.address,
69
+ latlng: hasLatLng
70
+ ? { lat: args.latitude, lng: args.longitude }
71
+ : undefined,
72
+ language: args.language,
73
+ });
74
+ cache.set(cacheKey, results, TTL_MS);
75
+ return {
76
+ content: [{ type: "text", text: JSON.stringify(results) }],
77
+ };
78
+ }
79
+ catch (err) {
80
+ const message = err instanceof Error ? err.message : String(err);
81
+ console.error(`[maps_geocode] error: ${message}`);
82
+ return {
83
+ content: [
84
+ { type: "text", text: JSON.stringify({ error: message }) },
85
+ ],
86
+ isError: true,
87
+ };
88
+ }
89
+ }
90
+ //# sourceMappingURL=geocode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geocode.js","sourceRoot":"","sources":["../../src/tools/geocode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAGrE,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AAEnD,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC;AAEvC,oDAAoD;AACpD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,+EAA+E,C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AAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ export declare const toolName = "maps_place_details";
3
+ export declare const inputSchema: {
4
+ place_id: z.ZodString;
5
+ fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
+ language: z.ZodOptional<z.ZodString>;
7
+ };
8
+ export declare const toolConfig: {
9
+ title: string;
10
+ description: string;
11
+ inputSchema: {
12
+ place_id: z.ZodString;
13
+ fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
+ language: z.ZodOptional<z.ZodString>;
15
+ };
16
+ annotations: {
17
+ readOnlyHint: boolean;
18
+ destructiveHint: boolean;
19
+ openWorldHint: boolean;
20
+ };
21
+ };
22
+ type PlaceDetailsArgs = {
23
+ place_id: string;
24
+ fields?: string[];
25
+ language?: string;
26
+ };
27
+ export declare function handler(args: PlaceDetailsArgs): Promise<{
28
+ content: {
29
+ type: "text";
30
+ text: string;
31
+ }[];
32
+ isError?: undefined;
33
+ } | {
34
+ content: {
35
+ type: "text";
36
+ text: string;
37
+ }[];
38
+ isError: boolean;
39
+ }>;
40
+ export {};
41
+ //# sourceMappingURL=place-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"place-details.d.ts","sourceRoot":"","sources":["../../src/tools/place-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,QAAQ,uBAAuB,CAAC;AAE7C,eAAO,MAAM,WAAW;;;;CASvB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAUtB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,gBAAgB;;;;;;;;;;;;GA2BnD"}
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ import { cache } from "../utils/cache.js";
3
+ import { placeDetails as googlePlaceDetails } from "../utils/google-client.js";
4
+ const TTL_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
5
+ // Map user-friendly field names to Google API field names
6
+ const FIELD_ALIASES = {
7
+ address: "formatted_address",
8
+ phone: "international_phone_number",
9
+ hours: "opening_hours",
10
+ location: "geometry",
11
+ };
12
+ export const toolName = "maps_place_details";
13
+ export const inputSchema = {
14
+ place_id: z.string().describe("Google Place ID from a previous search result"),
15
+ fields: z
16
+ .array(z.string())
17
+ .optional()
18
+ .describe("Specific fields to return. Fewer fields = lower API cost. Available: name, address, phone, website, rating, hours, reviews"),
19
+ language: z.string().optional().describe("Response language code. Default: 'en'"),
20
+ };
21
+ export const toolConfig = {
22
+ title: "Place Details",
23
+ description: "Get detailed information about a specific place using its Google Place ID. Returns opening hours, phone number, website, reviews, and ratings. Use this after search to get more info about a place the user is interested in.",
24
+ inputSchema,
25
+ annotations: {
26
+ readOnlyHint: true,
27
+ destructiveHint: false,
28
+ openWorldHint: true,
29
+ },
30
+ };
31
+ export async function handler(args) {
32
+ try {
33
+ const resolvedFields = args.fields?.map((f) => FIELD_ALIASES[f] ?? f);
34
+ const fieldsKey = (resolvedFields ?? []).sort().join(",");
35
+ const cacheKey = `place-details:${args.place_id}:${fieldsKey}:${args.language ?? "en"}`;
36
+ const cached = cache.get(cacheKey);
37
+ if (cached) {
38
+ return { content: [{ type: "text", text: JSON.stringify(cached) }] };
39
+ }
40
+ const result = await googlePlaceDetails({
41
+ place_id: args.place_id,
42
+ fields: resolvedFields,
43
+ language: args.language,
44
+ });
45
+ cache.set(cacheKey, result, TTL_MS);
46
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
47
+ }
48
+ catch (err) {
49
+ const message = err instanceof Error ? err.message : String(err);
50
+ console.error(`[maps_place_details] error: ${message}`);
51
+ return {
52
+ content: [{ type: "text", text: JSON.stringify({ error: message }) }],
53
+ isError: true,
54
+ };
55
+ }
56
+ }
57
+ //# sourceMappingURL=place-details.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"place-details.js","sourceRoot":"","sources":["../../src/tools/place-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/E,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AAEjD,0DAA0D;AAC1D,MAAM,aAAa,GAA2B;IAC5C,OAAO,EAAE,mBAAmB;IAC5B,KAAK,EAAE,4BAA4B;IACnC,KAAK,EAAE,eAAe;IACtB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AAE7C,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IAC9E,MAAM,EAAE,CAAC;SACN,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACP,4HAA4H,CAC7H;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;CAClF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,gOAAgO;IAClO,WAAW;IACX,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,aAAa,EAAE,IAAI;KACpB;CACF,CAAC;AAQF,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAsB;IAClD,IAAI,CAAC;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AO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YAC9E,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ export declare const toolName = "maps_search_places";
3
+ export declare const inputSchema: {
4
+ query: z.ZodString;
5
+ latitude: z.ZodOptional<z.ZodNumber>;
6
+ longitude: z.ZodOptional<z.ZodNumber>;
7
+ radius: z.ZodOptional<z.ZodNumber>;
8
+ type: z.ZodOptional<z.ZodString>;
9
+ language: z.ZodOptional<z.ZodString>;
10
+ };
11
+ export declare const toolConfig: {
12
+ title: string;
13
+ description: string;
14
+ inputSchema: {
15
+ query: z.ZodString;
16
+ latitude: z.ZodOptional<z.ZodNumber>;
17
+ longitude: z.ZodOptional<z.ZodNumber>;
18
+ radius: z.ZodOptional<z.ZodNumber>;
19
+ type: z.ZodOptional<z.ZodString>;
20
+ language: z.ZodOptional<z.ZodString>;
21
+ };
22
+ annotations: {
23
+ readOnlyHint: boolean;
24
+ destructiveHint: boolean;
25
+ openWorldHint: boolean;
26
+ };
27
+ };
28
+ type SearchPlacesArgs = {
29
+ query: string;
30
+ latitude?: number;
31
+ longitude?: number;
32
+ radius?: number;
33
+ type?: string;
34
+ language?: string;
35
+ };
36
+ export declare function handler(args: SearchPlacesArgs): Promise<{
37
+ content: {
38
+ type: "text";
39
+ text: string;
40
+ }[];
41
+ isError?: undefined;
42
+ } | {
43
+ content: {
44
+ type: "text";
45
+ text: string;
46
+ }[];
47
+ isError: boolean;
48
+ }>;
49
+ export {};
50
+ //# sourceMappingURL=search-places.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-places.d.ts","sourceRoot":"","sources":["../../src/tools/search-places.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,QAAQ,uBAAuB,CAAC;AAE7C,eAAO,MAAM,WAAW;;;;;;;CAavB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;CAUtB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,gBAAgB;;;;;;;;;;;;GA4BnD"}
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ import { cache } from "../utils/cache.js";
3
+ import { searchPlaces as googleSearchPlaces } from "../utils/google-client.js";
4
+ const TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
5
+ export const toolName = "maps_search_places";
6
+ export const inputSchema = {
7
+ query: z.string().describe("What to search for, e.g. 'sushi restaurants in Ginza'"),
8
+ latitude: z.number().optional().describe("Latitude to bias results near a location"),
9
+ longitude: z.number().optional().describe("Longitude to bias results near a location"),
10
+ radius: z
11
+ .number()
12
+ .optional()
13
+ .describe("Search radius in meters, max 50000. Default: 5000"),
14
+ type: z
15
+ .string()
16
+ .optional()
17
+ .describe("Place type filter: restaurant, hotel, cafe, tourist_attraction, etc."),
18
+ language: z.string().optional().describe("Response language code. Default: 'en'"),
19
+ };
20
+ export const toolConfig = {
21
+ title: "Search Places",
22
+ description: "Search for places by text query like 'ramen restaurants in Shinjuku' or 'coffee shops near Tokyo Tower'. Returns place names, addresses, ratings, and IDs. Use this when the user asks for recommendations or wants to find places.",
23
+ inputSchema,
24
+ annotations: {
25
+ readOnlyHint: true,
26
+ destructiveHint: false,
27
+ openWorldHint: true,
28
+ },
29
+ };
30
+ export async function handler(args) {
31
+ try {
32
+ const hasLocation = args.latitude !== undefined && args.longitude !== undefined;
33
+ const cacheKey = `search:${args.query.toLowerCase().trim()}:${args.latitude ?? ""}:${args.longitude ?? ""}:${args.radius ?? ""}:${args.type ?? ""}:${args.language ?? "en"}`;
34
+ const cached = cache.get(cacheKey);
35
+ if (cached) {
36
+ return { content: [{ type: "text", text: JSON.stringify(cached) }] };
37
+ }
38
+ const results = await googleSearchPlaces({
39
+ query: args.query,
40
+ location: hasLocation ? { lat: args.latitude, lng: args.longitude } : undefined,
41
+ radius: args.radius,
42
+ type: args.type,
43
+ language: args.language,
44
+ });
45
+ cache.set(cacheKey, results, TTL_MS);
46
+ return { content: [{ type: "text", text: JSON.stringify(results) }] };
47
+ }
48
+ catch (err) {
49
+ const message = err instanceof Error ? err.message : String(err);
50
+ console.error(`[maps_search_places] error: ${message}`);
51
+ return {
52
+ content: [{ type: "text", text: JSON.stringify({ error: message }) }],
53
+ isError: true,
54
+ };
55
+ }
56
+ }
57
+ //# sourceMappingURL=search-places.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-places.js","sourceRoot":"","sources":["../../src/tools/search-places.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/E,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;AAE/C,MAAM,CAAC,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AAE7C,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IACnF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;IACpF,SAAS,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C,EAAE,CAAC,EAAE,CAAC;QAChF,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC;YACvC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,QAAS,EAAE,GAAG,EAAE,IAAI,CAAC,SAAU,EAAE,CAAC,CAAC,CAAC,SAAS;YACjF,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACrC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;IACjF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,CAAC,KAAK,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;QACxD,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YAC9E,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ export declare const toolName = "maps_timezone";
3
+ export declare const inputSchema: {
4
+ latitude: z.ZodNumber;
5
+ longitude: z.ZodNumber;
6
+ timestamp: z.ZodOptional<z.ZodNumber>;
7
+ };
8
+ export declare const toolConfig: {
9
+ title: string;
10
+ description: string;
11
+ inputSchema: {
12
+ latitude: z.ZodNumber;
13
+ longitude: z.ZodNumber;
14
+ timestamp: z.ZodOptional<z.ZodNumber>;
15
+ };
16
+ annotations: {
17
+ readOnlyHint: boolean;
18
+ destructiveHint: boolean;
19
+ openWorldHint: boolean;
20
+ };
21
+ };
22
+ type TimezoneArgs = {
23
+ latitude: number;
24
+ longitude: number;
25
+ timestamp?: number;
26
+ };
27
+ export declare function handler(args: TimezoneArgs): Promise<{
28
+ content: {
29
+ type: "text";
30
+ text: string;
31
+ }[];
32
+ isError?: undefined;
33
+ } | {
34
+ content: {
35
+ type: "text";
36
+ text: string;
37
+ }[];
38
+ isError: boolean;
39
+ }>;
40
+ export {};
41
+ //# sourceMappingURL=timezone.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timezone.d.ts","sourceRoot":"","sources":["../../src/tools/timezone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AAExC,eAAO,MAAM,WAAW;;;;CASvB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAUtB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,YAAY;;;;;;;;;;;;GAwB/C"}
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ import { cache } from "../utils/cache.js";
3
+ import { timezoneInfo } from "../utils/google-client.js";
4
+ const TTL_MS = 90 * 24 * 60 * 60 * 1000; // 90 days
5
+ export const toolName = "maps_timezone";
6
+ export const inputSchema = {
7
+ latitude: z.number().describe("Latitude of the location"),
8
+ longitude: z.number().describe("Longitude of the location"),
9
+ timestamp: z
10
+ .number()
11
+ .optional()
12
+ .describe("Unix timestamp in seconds. Default: current time. Use specific dates to account for daylight saving."),
13
+ };
14
+ export const toolConfig = {
15
+ title: "Timezone Lookup",
16
+ description: "Get timezone information for a location by its coordinates. Returns timezone ID, name, and UTC offset. Use this to show local times in trip itineraries or convert between timezones for travel planning.",
17
+ inputSchema,
18
+ annotations: {
19
+ readOnlyHint: true,
20
+ destructiveHint: false,
21
+ openWorldHint: true,
22
+ },
23
+ };
24
+ export async function handler(args) {
25
+ try {
26
+ // Round to 4 decimal places (~11m precision) for cache key stability
27
+ const lat = Math.round(args.latitude * 10000) / 10000;
28
+ const lng = Math.round(args.longitude * 10000) / 10000;
29
+ const cacheKey = `timezone:${lat},${lng}`;
30
+ const cached = cache.get(cacheKey);
31
+ if (cached) {
32
+ return { content: [{ type: "text", text: JSON.stringify(cached) }] };
33
+ }
34
+ const result = await timezoneInfo({ lat: args.latitude, lng: args.longitude, timestamp: args.timestamp });
35
+ cache.set(cacheKey, result, TTL_MS);
36
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
37
+ }
38
+ catch (err) {
39
+ const message = err instanceof Error ? err.message : String(err);
40
+ console.error(`[maps_timezone] error: ${message}`);
41
+ return {
42
+ content: [{ type: "text", text: JSON.stringify({ error: message }) }],
43
+ isError: true,
44
+ };
45
+ }
46
+ }
47
+ //# sourceMappingURL=timezone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timezone.js","sourceRoot":"","sources":["../../src/tools/timezone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AAEnD,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;AAExC,MAAM,CA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EAAE,CAAC,CAAC;QAE1G,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACpC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAChF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,CAAC,KAAK,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC;QACnD,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YAC9E,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,107 @@
1
+ /** Latitude/longitude coordinate pair */
2
+ export interface LatLng {
3
+ lat: number;
4
+ lng: number;
5
+ }
6
+ /** Normalized geocoding result returned to MCP clients */
7
+ export interface GeocodeResult {
8
+ formatted_address: string;
9
+ location: LatLng;
10
+ place_id: string;
11
+ types: string[];
12
+ }
13
+ /** Generic cache entry with expiration timestamp */
14
+ export interface CacheEntry<T> {
15
+ data: T;
16
+ expires_at: number;
17
+ }
18
+ /** Structured tool error */
19
+ export interface ToolError {
20
+ error: string;
21
+ code?: string;
22
+ }
23
+ /** Result from Places Text Search */
24
+ export interface PlaceSearchResult {
25
+ place_id: string;
26
+ name: string;
27
+ formatted_address: string;
28
+ location: LatLng;
29
+ rating?: number;
30
+ types: string[];
31
+ }
32
+ /** Opening hours info returned by Place Details */
33
+ export interface OpeningHours {
34
+ open_now?: boolean;
35
+ weekday_text?: string[];
36
+ }
37
+ /** A single user review */
38
+ export interface PlaceReview {
39
+ author_name: string;
40
+ rating: number;
41
+ text: string;
42
+ time: string;
43
+ }
44
+ /** A single step in a route */
45
+ export interface RouteStep {
46
+ instruction: string;
47
+ distance: {
48
+ text: string;
49
+ value: number;
50
+ };
51
+ duration: {
52
+ text: string;
53
+ value: number;
54
+ };
55
+ }
56
+ /** Result from the Routes API (Compute Route) */
57
+ export interface DirectionsResult {
58
+ summary: string;
59
+ distance: {
60
+ text: string;
61
+ value: number;
62
+ };
63
+ duration: {
64
+ text: string;
65
+ value: number;
66
+ };
67
+ steps: RouteStep[];
68
+ }
69
+ /** A single cell in the distance matrix */
70
+ export interface MatrixElement {
71
+ origin: string;
72
+ destination: string;
73
+ distance: {
74
+ text: string;
75
+ value: number;
76
+ };
77
+ duration: {
78
+ text: string;
79
+ value: number;
80
+ };
81
+ status: string;
82
+ }
83
+ /** Result from the Distance Matrix API */
84
+ export interface DistanceMatrixResult {
85
+ elements: MatrixElement[];
86
+ }
87
+ /** Result from the Timezone API */
88
+ export interface TimezoneResult {
89
+ timezone_id: string;
90
+ timezone_name: string;
91
+ utc_offset_seconds: number;
92
+ dst_offset_seconds: number;
93
+ }
94
+ /** Rich place info from Place Details API */
95
+ export interface PlaceDetailsResult {
96
+ place_id: string;
97
+ name: string;
98
+ formatted_address: string;
99
+ location: LatLng;
100
+ rating?: number;
101
+ opening_hours?: OpeningHours;
102
+ phone?: string;
103
+ website?: string;
104
+ reviews?: PlaceReview[];
105
+ types?: string[];
106
+ }
107
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,MAAM,CAAC;I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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ declare class Cache {
2
+ private store;
3
+ /**
4
+ * Retrieve a cached value. Returns null if missing or expired.
5
+ */
6
+ get<T>(key: string): T | null;
7
+ /**
8
+ * Store a value with a TTL in milliseconds.
9
+ */
10
+ set<T>(key: string, data: T, ttl_ms: number): void;
11
+ /** Check if key exists and has not expired. */
12
+ has(key: string): boolean;
13
+ /** Remove a specific key. */
14
+ delete(key: string): void;
15
+ /** Clear all cached entries. */
16
+ clear(): void;
17
+ }
18
+ /** Singleton cache instance shared across all tools. */
19
+ export declare const cache: Cache;
20
+ export {};
21
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/utils/cache.ts"],"names":[],"mappings":"AAEA,cAAM,KAAK;IACT,OAAO,CAAC,KAAK,CAA0C;IAEvD;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAe7B;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAIlD,+CAA+C;IAC/C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,6BAA6B;IAC7B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,gCAAgC;IAChC,KAAK,IAAI,IAAI;CAGd;AAED,wDAAwD;AACxD,eAAO,MAAM,KAAK,OAAc,CAAC"}
@@ -0,0 +1,41 @@
1
+ class Cache {
2
+ store = new Map();
3
+ /**
4
+ * Retrieve a cached value. Returns null if missing or expired.
5
+ */
6
+ get(key) {
7
+ const entry = this.store.get(key);
8
+ if (!entry) {
9
+ console.error(`[cache] miss: ${key}`);
10
+ return null;
11
+ }
12
+ if (Date.now() > entry.expires_at) {
13
+ this.store.delete(key);
14
+ console.error(`[cache] expired: ${key}`);
15
+ return null;
16
+ }
17
+ console.error(`[cache] hit: ${key}`);
18
+ return entry.data;
19
+ }
20
+ /**
21
+ * Store a value with a TTL in milliseconds.
22
+ */
23
+ set(key, data, ttl_ms) {
24
+ this.store.set(key, { data, expires_at: Date.now() + ttl_ms });
25
+ }
26
+ /** Check if key exists and has not expired. */
27
+ has(key) {
28
+ return this.get(key) !== null;
29
+ }
30
+ /** Remove a specific key. */
31
+ delete(key) {
32
+ this.store.delete(key);
33
+ }
34
+ /** Clear all cached entries. */
35
+ clear() {
36
+ this.store.clear();
37
+ }
38
+ }
39
+ /** Singleton cache instance shared across all tools. */
40
+ export const cache = new Cache();
41
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/utils/cache.ts"],"names":[],"mappings":"AAEA,MAAM,KAAK;IACD,KAAK,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEvD;;OAEG;IACH,GAAG,CAAI,GAAW;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAA8B,CAAC;QAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACvB,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CA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