@opentabs-dev/opentabs-plugin-zillow 0.0.74

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 (65) hide show
  1. package/README.md +159 -0
  2. package/dist/adapter.iife.js +15211 -0
  3. package/dist/adapter.iife.js.map +7 -0
  4. package/dist/index.d.ts +14 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +47 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/tools/get-current-user.d.ts +14 -0
  9. package/dist/tools/get-current-user.d.ts.map +1 -0
  10. package/dist/tools/get-current-user.js +19 -0
  11. package/dist/tools/get-current-user.js.map +1 -0
  12. package/dist/tools/get-market-overview.d.ts +10 -0
  13. package/dist/tools/get-market-overview.d.ts.map +1 -0
  14. package/dist/tools/get-market-overview.js +70 -0
  15. package/dist/tools/get-market-overview.js.map +1 -0
  16. package/dist/tools/get-saved-homes.d.ts +6 -0
  17. package/dist/tools/get-saved-homes.d.ts.map +1 -0
  18. package/dist/tools/get-saved-homes.js +30 -0
  19. package/dist/tools/get-saved-homes.js.map +1 -0
  20. package/dist/tools/schemas.d.ts +99 -0
  21. package/dist/tools/schemas.d.ts.map +1 -0
  22. package/dist/tools/schemas.js +101 -0
  23. package/dist/tools/schemas.js.map +1 -0
  24. package/dist/tools/search-by-address.d.ts +32 -0
  25. package/dist/tools/search-by-address.d.ts.map +1 -0
  26. package/dist/tools/search-by-address.js +49 -0
  27. package/dist/tools/search-by-address.js.map +1 -0
  28. package/dist/tools/search-by-owner.d.ts +51 -0
  29. package/dist/tools/search-by-owner.d.ts.map +1 -0
  30. package/dist/tools/search-by-owner.js +78 -0
  31. package/dist/tools/search-by-owner.js.map +1 -0
  32. package/dist/tools/search-for-rent.d.ts +56 -0
  33. package/dist/tools/search-for-rent.d.ts.map +1 -0
  34. package/dist/tools/search-for-rent.js +86 -0
  35. package/dist/tools/search-for-rent.js.map +1 -0
  36. package/dist/tools/search-for-sale.d.ts +68 -0
  37. package/dist/tools/search-for-sale.d.ts.map +1 -0
  38. package/dist/tools/search-for-sale.js +98 -0
  39. package/dist/tools/search-for-sale.js.map +1 -0
  40. package/dist/tools/search-foreclosures.d.ts +49 -0
  41. package/dist/tools/search-foreclosures.d.ts.map +1 -0
  42. package/dist/tools/search-foreclosures.js +75 -0
  43. package/dist/tools/search-foreclosures.js.map +1 -0
  44. package/dist/tools/search-locations.d.ts +18 -0
  45. package/dist/tools/search-locations.d.ts.map +1 -0
  46. package/dist/tools/search-locations.js +23 -0
  47. package/dist/tools/search-locations.js.map +1 -0
  48. package/dist/tools/search-new-construction.d.ts +51 -0
  49. package/dist/tools/search-new-construction.d.ts.map +1 -0
  50. package/dist/tools/search-new-construction.js +78 -0
  51. package/dist/tools/search-new-construction.js.map +1 -0
  52. package/dist/tools/search-open-houses.d.ts +41 -0
  53. package/dist/tools/search-open-houses.d.ts.map +1 -0
  54. package/dist/tools/search-open-houses.js +59 -0
  55. package/dist/tools/search-open-houses.js.map +1 -0
  56. package/dist/tools/search-recently-sold.d.ts +52 -0
  57. package/dist/tools/search-recently-sold.d.ts.map +1 -0
  58. package/dist/tools/search-recently-sold.js +82 -0
  59. package/dist/tools/search-recently-sold.js.map +1 -0
  60. package/dist/tools.json +2056 -0
  61. package/dist/zillow-api.d.ts +143 -0
  62. package/dist/zillow-api.d.ts.map +1 -0
  63. package/dist/zillow-api.js +82 -0
  64. package/dist/zillow-api.js.map +1 -0
  65. package/package.json +55 -0
@@ -0,0 +1,78 @@
1
+ import { defineTool, ToolError } from '@opentabs-dev/plugin-sdk';
2
+ import { z } from 'zod';
3
+ import { search, REGION_TYPE_MAP } from '../zillow-api.js';
4
+ import { listingSchema, mapListing } from './schemas.js';
5
+ export const searchByOwner = defineTool({
6
+ name: 'search_by_owner',
7
+ displayName: 'Search For Sale by Owner',
8
+ description: 'Search for properties listed for sale by owner (FSBO) on Zillow. Requires either a region_id (from search_locations) or map_bounds.',
9
+ summary: 'Find for-sale-by-owner listings',
10
+ icon: 'user-check',
11
+ group: 'Search',
12
+ input: z.object({
13
+ region_id: z
14
+ .number()
15
+ .int()
16
+ .optional()
17
+ .describe('Zillow region ID (from search_locations). Required if map_bounds is not provided.'),
18
+ region_type: z
19
+ .string()
20
+ .optional()
21
+ .describe('Region type: "city", "county", "zipcode", "neighborhood" (default "city")'),
22
+ map_bounds: z
23
+ .object({
24
+ west: z.number().describe('Western longitude'),
25
+ east: z.number().describe('Eastern longitude'),
26
+ south: z.number().describe('Southern latitude'),
27
+ north: z.number().describe('Northern latitude'),
28
+ })
29
+ .optional()
30
+ .describe('Map bounding box. Required if region_id is not provided.'),
31
+ min_price: z.number().optional().describe('Minimum price in dollars'),
32
+ max_price: z.number().optional().describe('Maximum price in dollars'),
33
+ min_beds: z.number().int().optional().describe('Minimum bedrooms'),
34
+ sort: z
35
+ .enum(['globalrelevanceex', 'days', 'pricea', 'priced', 'size'])
36
+ .optional()
37
+ .describe('Sort order (default "globalrelevanceex")'),
38
+ page: z.number().int().min(1).optional().describe('Page number (default 1)'),
39
+ }),
40
+ output: z.object({
41
+ total: z.number().describe('Total FSBO listings'),
42
+ listings: z.array(listingSchema).describe('For-sale-by-owner listings'),
43
+ }),
44
+ handle: async (params) => {
45
+ if (!params.region_id && !params.map_bounds) {
46
+ throw ToolError.validation('Either region_id or map_bounds is required.');
47
+ }
48
+ const filterState = {
49
+ isForSaleByOwner: { value: true },
50
+ isForSaleByAgent: { value: false },
51
+ isNewConstruction: { value: false },
52
+ isComingSoon: { value: false },
53
+ isAuction: { value: false },
54
+ isForSaleForeclosure: { value: false },
55
+ };
56
+ if (params.sort)
57
+ filterState.sortSelection = { value: params.sort };
58
+ if (params.min_price || params.max_price)
59
+ filterState.price = { min: params.min_price, max: params.max_price };
60
+ if (params.min_beds)
61
+ filterState.beds = { min: params.min_beds };
62
+ const bounds = params.map_bounds ?? { west: -122.5, east: -122.3, south: 37.7, north: 37.8 };
63
+ const data = await search({
64
+ pagination: params.page && params.page > 1 ? { currentPage: params.page } : undefined,
65
+ mapBounds: bounds,
66
+ regionSelection: params.region_id
67
+ ? [{ regionId: params.region_id, regionType: REGION_TYPE_MAP[params.region_type ?? 'city'] ?? 6 }]
68
+ : undefined,
69
+ filterState,
70
+ isMapVisible: true,
71
+ }, { cat1: ['listResults', 'total'] });
72
+ return {
73
+ total: data.categoryTotals?.cat1?.totalResultCount ?? data.cat1?.searchResults?.listResults?.length ?? 0,
74
+ listings: (data.cat1?.searchResults?.listResults ?? []).map(mapListing),
75
+ };
76
+ },
77
+ });
78
+ //# sourceMappingURL=search-by-owner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-by-owner.js","sourceRoot":"","sources":["../../src/tools/search-by-owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,0BAA0B;IACvC,WAAW,EACT,qIAAqI;IACvI,OAAO,EAAE,iCAAiC;IAC1C,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,GAAG,EAAE;aACL,QAAQ,EAAE;aACV,QAAQ,CAAC,mFAAmF,CAAC;QAChG,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,2EAA2E,CAAC;QACxF,UAAU,EAAE,CAAC;aACV,MAAM,CAAC;YACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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ACrF,SAAS,EAAE,MAAM;YACjB,eAAe,EAAE,MAAM,CAAC,SAAS;gBAC/B,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClG,CAAC,CAAC,SAAS;YACb,WAAW;YACX,YAAY,EAAE,IAAI;SACnB,EACD,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,EAAE,CACnC,CAAC;QAEF,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,gBAAgB,IAAI,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;YACxG,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;SACxE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ export declare const searchForRent: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
3
+ region_id: z.ZodOptional<z.ZodNumber>;
4
+ region_type: z.ZodOptional<z.ZodString>;
5
+ map_bounds: z.ZodOptional<z.ZodObject<{
6
+ west: z.ZodNumber;
7
+ east: z.ZodNumber;
8
+ south: z.ZodNumber;
9
+ north: z.ZodNumber;
10
+ }, z.core.$strip>>;
11
+ min_price: z.ZodOptional<z.ZodNumber>;
12
+ max_price: z.ZodOptional<z.ZodNumber>;
13
+ min_beds: z.ZodOptional<z.ZodNumber>;
14
+ min_baths: z.ZodOptional<z.ZodNumber>;
15
+ min_sqft: z.ZodOptional<z.ZodNumber>;
16
+ max_sqft: z.ZodOptional<z.ZodNumber>;
17
+ sort: z.ZodOptional<z.ZodEnum<{
18
+ beds: "beds";
19
+ baths: "baths";
20
+ globalrelevanceex: "globalrelevanceex";
21
+ days: "days";
22
+ pricea: "pricea";
23
+ priced: "priced";
24
+ size: "size";
25
+ }>>;
26
+ page: z.ZodOptional<z.ZodNumber>;
27
+ }, z.core.$strip>, z.ZodObject<{
28
+ total: z.ZodNumber;
29
+ listings: z.ZodArray<z.ZodObject<{
30
+ zpid: z.ZodString;
31
+ address: z.ZodString;
32
+ street: z.ZodString;
33
+ city: z.ZodString;
34
+ state: z.ZodString;
35
+ zipcode: z.ZodString;
36
+ price: z.ZodString;
37
+ price_raw: z.ZodNumber;
38
+ beds: z.ZodNumber;
39
+ baths: z.ZodNumber;
40
+ sqft: z.ZodNumber;
41
+ status: z.ZodString;
42
+ status_text: z.ZodString;
43
+ home_type: z.ZodString;
44
+ days_on_zillow: z.ZodNumber;
45
+ zestimate: z.ZodNumber;
46
+ rent_zestimate: z.ZodNumber;
47
+ tax_assessed_value: z.ZodNumber;
48
+ latitude: z.ZodNumber;
49
+ longitude: z.ZodNumber;
50
+ image_url: z.ZodString;
51
+ detail_url: z.ZodString;
52
+ is_saved: z.ZodBoolean;
53
+ has_3d_model: z.ZodBoolean;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>>;
56
+ //# sourceMappingURL=search-for-rent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-for-rent.d.ts","sourceRoot":"","sources":["../../src/tools/search-for-rent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsFxB,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { defineTool, ToolError } from '@opentabs-dev/plugin-sdk';
2
+ import { z } from 'zod';
3
+ import { search, REGION_TYPE_MAP } from '../zillow-api.js';
4
+ import { listingSchema, mapListing } from './schemas.js';
5
+ export const searchForRent = defineTool({
6
+ name: 'search_for_rent',
7
+ displayName: 'Search For Rent',
8
+ description: 'Search for rental properties on Zillow. Requires either a region_id (from search_locations) or map_bounds. Supports filtering by price, beds, baths, and more. Returns up to 41 results per page.',
9
+ summary: 'Search rental properties',
10
+ icon: 'building',
11
+ group: 'Search',
12
+ input: z.object({
13
+ region_id: z
14
+ .number()
15
+ .int()
16
+ .optional()
17
+ .describe('Zillow region ID (from search_locations). Required if map_bounds is not provided.'),
18
+ region_type: z
19
+ .string()
20
+ .optional()
21
+ .describe('Region type: "city", "county", "zipcode", "neighborhood" (default "city")'),
22
+ map_bounds: z
23
+ .object({
24
+ west: z.number().describe('Western longitude'),
25
+ east: z.number().describe('Eastern longitude'),
26
+ south: z.number().describe('Southern latitude'),
27
+ north: z.number().describe('Northern latitude'),
28
+ })
29
+ .optional()
30
+ .describe('Map bounding box. Required if region_id is not provided.'),
31
+ min_price: z.number().optional().describe('Minimum monthly rent in dollars'),
32
+ max_price: z.number().optional().describe('Maximum monthly rent in dollars'),
33
+ min_beds: z.number().int().optional().describe('Minimum bedrooms'),
34
+ min_baths: z.number().int().optional().describe('Minimum bathrooms'),
35
+ min_sqft: z.number().optional().describe('Minimum square footage'),
36
+ max_sqft: z.number().optional().describe('Maximum square footage'),
37
+ sort: z
38
+ .enum(['globalrelevanceex', 'days', 'pricea', 'priced', 'size', 'beds', 'baths'])
39
+ .optional()
40
+ .describe('Sort order (default "globalrelevanceex"). "days"=Newest, "pricea"=Price low-high, "priced"=Price high-low'),
41
+ page: z.number().int().min(1).optional().describe('Page number (default 1)'),
42
+ }),
43
+ output: z.object({
44
+ total: z.number().describe('Total number of matching rentals'),
45
+ listings: z.array(listingSchema).describe('Rental listings'),
46
+ }),
47
+ handle: async (params) => {
48
+ if (!params.region_id && !params.map_bounds) {
49
+ throw ToolError.validation('Either region_id or map_bounds is required.');
50
+ }
51
+ const filterState = {
52
+ isForRent: { value: true },
53
+ isForSaleByAgent: { value: false },
54
+ isForSaleByOwner: { value: false },
55
+ isNewConstruction: { value: false },
56
+ isComingSoon: { value: false },
57
+ isAuction: { value: false },
58
+ isForSaleForeclosure: { value: false },
59
+ };
60
+ if (params.sort)
61
+ filterState.sortSelection = { value: params.sort };
62
+ if (params.min_price || params.max_price)
63
+ filterState.price = { min: params.min_price, max: params.max_price };
64
+ if (params.min_beds)
65
+ filterState.beds = { min: params.min_beds };
66
+ if (params.min_baths)
67
+ filterState.baths = { min: params.min_baths };
68
+ if (params.min_sqft || params.max_sqft)
69
+ filterState.sqft = { min: params.min_sqft, max: params.max_sqft };
70
+ const bounds = params.map_bounds ?? { west: -122.5, east: -122.3, south: 37.7, north: 37.8 };
71
+ const data = await search({
72
+ pagination: params.page && params.page > 1 ? { currentPage: params.page } : undefined,
73
+ mapBounds: bounds,
74
+ regionSelection: params.region_id
75
+ ? [{ regionId: params.region_id, regionType: REGION_TYPE_MAP[params.region_type ?? 'city'] ?? 6 }]
76
+ : undefined,
77
+ filterState,
78
+ isMapVisible: true,
79
+ }, { cat1: ['listResults', 'total'] });
80
+ return {
81
+ total: data.categoryTotals?.cat1?.totalResultCount ?? data.cat1?.searchResults?.listResults?.length ?? 0,
82
+ listings: (data.cat1?.searchResults?.listResults ?? []).map(mapListing),
83
+ };
84
+ },
85
+ });
86
+ //# sourceMappingURL=search-for-rent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-for-rent.js","sourceRoot":"","sources":["../../src/tools/search-for-rent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EACT,mMAAmM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AAW,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClG,CAAC,CAAC,SAAS;YACb,WAAW;YACX,YAAY,EAAE,IAAI;SACnB,EACD,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,EAAE,CACnC,CAAC;QAEF,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,gBAAgB,IAAI,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;YACxG,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;SACxE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ export declare const searchForSale: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
3
+ region_id: z.ZodOptional<z.ZodNumber>;
4
+ region_type: z.ZodOptional<z.ZodString>;
5
+ map_bounds: z.ZodOptional<z.ZodObject<{
6
+ west: z.ZodNumber;
7
+ east: z.ZodNumber;
8
+ south: z.ZodNumber;
9
+ north: z.ZodNumber;
10
+ }, z.core.$strip>>;
11
+ min_price: z.ZodOptional<z.ZodNumber>;
12
+ max_price: z.ZodOptional<z.ZodNumber>;
13
+ min_beds: z.ZodOptional<z.ZodNumber>;
14
+ max_beds: z.ZodOptional<z.ZodNumber>;
15
+ min_baths: z.ZodOptional<z.ZodNumber>;
16
+ min_sqft: z.ZodOptional<z.ZodNumber>;
17
+ max_sqft: z.ZodOptional<z.ZodNumber>;
18
+ home_type: z.ZodOptional<z.ZodEnum<{
19
+ single_family: "single_family";
20
+ condo: "condo";
21
+ townhouse: "townhouse";
22
+ multi_family: "multi_family";
23
+ lot_land: "lot_land";
24
+ manufactured: "manufactured";
25
+ }>>;
26
+ sort: z.ZodOptional<z.ZodEnum<{
27
+ beds: "beds";
28
+ baths: "baths";
29
+ globalrelevanceex: "globalrelevanceex";
30
+ days: "days";
31
+ pricea: "pricea";
32
+ priced: "priced";
33
+ size: "size";
34
+ zest: "zest";
35
+ zesta: "zesta";
36
+ lot: "lot";
37
+ }>>;
38
+ page: z.ZodOptional<z.ZodNumber>;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ total: z.ZodNumber;
41
+ listings: z.ZodArray<z.ZodObject<{
42
+ zpid: z.ZodString;
43
+ address: z.ZodString;
44
+ street: z.ZodString;
45
+ city: z.ZodString;
46
+ state: z.ZodString;
47
+ zipcode: z.ZodString;
48
+ price: z.ZodString;
49
+ price_raw: z.ZodNumber;
50
+ beds: z.ZodNumber;
51
+ baths: z.ZodNumber;
52
+ sqft: z.ZodNumber;
53
+ status: z.ZodString;
54
+ status_text: z.ZodString;
55
+ home_type: z.ZodString;
56
+ days_on_zillow: z.ZodNumber;
57
+ zestimate: z.ZodNumber;
58
+ rent_zestimate: z.ZodNumber;
59
+ tax_assessed_value: z.ZodNumber;
60
+ latitude: z.ZodNumber;
61
+ longitude: z.ZodNumber;
62
+ image_url: z.ZodString;
63
+ detail_url: z.ZodString;
64
+ is_saved: z.ZodBoolean;
65
+ has_3d_model: z.ZodBoolean;
66
+ }, z.core.$strip>>;
67
+ }, z.core.$strip>>;
68
+ //# sourceMappingURL=search-for-sale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-for-sale.d.ts","sourceRoot":"","sources":["../../src/tools/search-for-sale.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAgGxB,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { defineTool, ToolError } from '@opentabs-dev/plugin-sdk';
2
+ import { z } from 'zod';
3
+ import { search, REGION_TYPE_MAP } from '../zillow-api.js';
4
+ import { listingSchema, mapListing } from './schemas.js';
5
+ export const searchForSale = defineTool({
6
+ name: 'search_for_sale',
7
+ displayName: 'Search For Sale',
8
+ description: 'Search for properties currently for sale on Zillow. Requires either a region_id (from search_locations) or map_bounds. Supports filtering by price, beds, baths, square footage, home type, and more. Returns up to 41 results per page with pagination support.',
9
+ summary: 'Search properties for sale',
10
+ icon: 'home',
11
+ group: 'Search',
12
+ input: z.object({
13
+ region_id: z
14
+ .number()
15
+ .int()
16
+ .optional()
17
+ .describe('Zillow region ID (from search_locations). Required if map_bounds is not provided.'),
18
+ region_type: z
19
+ .string()
20
+ .optional()
21
+ .describe('Region type: "city", "county", "zipcode", "neighborhood" (default "city")'),
22
+ map_bounds: z
23
+ .object({
24
+ west: z.number().describe('Western longitude'),
25
+ east: z.number().describe('Eastern longitude'),
26
+ south: z.number().describe('Southern latitude'),
27
+ north: z.number().describe('Northern latitude'),
28
+ })
29
+ .optional()
30
+ .describe('Map bounding box. Required if region_id is not provided.'),
31
+ min_price: z.number().optional().describe('Minimum price in dollars'),
32
+ max_price: z.number().optional().describe('Maximum price in dollars'),
33
+ min_beds: z.number().int().optional().describe('Minimum bedrooms'),
34
+ max_beds: z.number().int().optional().describe('Maximum bedrooms'),
35
+ min_baths: z.number().int().optional().describe('Minimum bathrooms'),
36
+ min_sqft: z.number().optional().describe('Minimum square footage'),
37
+ max_sqft: z.number().optional().describe('Maximum square footage'),
38
+ home_type: z
39
+ .enum(['single_family', 'condo', 'townhouse', 'multi_family', 'lot_land', 'manufactured'])
40
+ .optional()
41
+ .describe('Property type filter'),
42
+ sort: z
43
+ .enum(['globalrelevanceex', 'days', 'pricea', 'priced', 'zest', 'zesta', 'size', 'lot', 'beds', 'baths'])
44
+ .optional()
45
+ .describe('Sort order (default "globalrelevanceex" = Homes for You). "days"=Newest, "pricea"=Price low-high, "priced"=Price high-low, "zest"=Zestimate high-low'),
46
+ page: z.number().int().min(1).optional().describe('Page number (default 1)'),
47
+ }),
48
+ output: z.object({
49
+ total: z.number().describe('Total number of matching listings'),
50
+ listings: z.array(listingSchema).describe('Property listings'),
51
+ }),
52
+ handle: async (params) => {
53
+ if (!params.region_id && !params.map_bounds) {
54
+ throw ToolError.validation('Either region_id or map_bounds is required.');
55
+ }
56
+ const filterState = {};
57
+ if (params.sort)
58
+ filterState.sortSelection = { value: params.sort };
59
+ if (params.min_price || params.max_price)
60
+ filterState.price = { min: params.min_price, max: params.max_price };
61
+ if (params.min_beds)
62
+ filterState.beds = { min: params.min_beds };
63
+ if (params.max_beds)
64
+ filterState.beds = { ...filterState.beds, max: params.max_beds };
65
+ if (params.min_baths)
66
+ filterState.baths = { min: params.min_baths };
67
+ if (params.min_sqft || params.max_sqft)
68
+ filterState.sqft = { min: params.min_sqft, max: params.max_sqft };
69
+ if (params.home_type) {
70
+ const typeMap = {
71
+ single_family: 'isSingleFamily',
72
+ condo: 'isCondo',
73
+ townhouse: 'isTownhouse',
74
+ multi_family: 'isMultiFamily',
75
+ lot_land: 'isLotLand',
76
+ manufactured: 'isManufactured',
77
+ };
78
+ const key = typeMap[params.home_type];
79
+ if (key)
80
+ filterState[key] = { value: true };
81
+ }
82
+ const bounds = params.map_bounds ?? { west: -122.5, east: -122.3, south: 37.7, north: 37.8 };
83
+ const data = await search({
84
+ pagination: params.page && params.page > 1 ? { currentPage: params.page } : undefined,
85
+ mapBounds: bounds,
86
+ regionSelection: params.region_id
87
+ ? [{ regionId: params.region_id, regionType: REGION_TYPE_MAP[params.region_type ?? 'city'] ?? 6 }]
88
+ : undefined,
89
+ filterState,
90
+ isMapVisible: true,
91
+ }, { cat1: ['listResults', 'total'], cat2: ['total'] });
92
+ return {
93
+ total: data.categoryTotals?.cat1?.totalResultCount ?? data.cat1?.searchResults?.listResults?.length ?? 0,
94
+ listings: (data.cat1?.searchResults?.listResults ?? []).map(mapListing),
95
+ };
96
+ },
97
+ });
98
+ //# sourceMappingURL=search-for-sale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-for-sale.js","sour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AI,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;YACxG,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;SACxE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ export declare const searchForeclosures: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
3
+ region_id: z.ZodOptional<z.ZodNumber>;
4
+ region_type: z.ZodOptional<z.ZodString>;
5
+ map_bounds: z.ZodOptional<z.ZodObject<{
6
+ west: z.ZodNumber;
7
+ east: z.ZodNumber;
8
+ south: z.ZodNumber;
9
+ north: z.ZodNumber;
10
+ }, z.core.$strip>>;
11
+ min_price: z.ZodOptional<z.ZodNumber>;
12
+ max_price: z.ZodOptional<z.ZodNumber>;
13
+ sort: z.ZodOptional<z.ZodEnum<{
14
+ globalrelevanceex: "globalrelevanceex";
15
+ days: "days";
16
+ pricea: "pricea";
17
+ priced: "priced";
18
+ }>>;
19
+ page: z.ZodOptional<z.ZodNumber>;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ total: z.ZodNumber;
22
+ listings: z.ZodArray<z.ZodObject<{
23
+ zpid: z.ZodString;
24
+ address: z.ZodString;
25
+ street: z.ZodString;
26
+ city: z.ZodString;
27
+ state: z.ZodString;
28
+ zipcode: z.ZodString;
29
+ price: z.ZodString;
30
+ price_raw: z.ZodNumber;
31
+ beds: z.ZodNumber;
32
+ baths: z.ZodNumber;
33
+ sqft: z.ZodNumber;
34
+ status: z.ZodString;
35
+ status_text: z.ZodString;
36
+ home_type: z.ZodString;
37
+ days_on_zillow: z.ZodNumber;
38
+ zestimate: z.ZodNumber;
39
+ rent_zestimate: z.ZodNumber;
40
+ tax_assessed_value: z.ZodNumber;
41
+ latitude: z.ZodNumber;
42
+ longitude: z.ZodNumber;
43
+ image_url: z.ZodString;
44
+ detail_url: z.ZodString;
45
+ is_saved: z.ZodBoolean;
46
+ has_3d_model: z.ZodBoolean;
47
+ }, z.core.$strip>>;
48
+ }, z.core.$strip>>;
49
+ //# sourceMappingURL=search-foreclosures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-foreclosures.d.ts","sourceRoot":"","sources":["../../src/tools/search-foreclosures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4E7B,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { defineTool, ToolError } from '@opentabs-dev/plugin-sdk';
2
+ import { z } from 'zod';
3
+ import { search, REGION_TYPE_MAP } from '../zillow-api.js';
4
+ import { listingSchema, mapListing } from './schemas.js';
5
+ export const searchForeclosures = defineTool({
6
+ name: 'search_foreclosures',
7
+ displayName: 'Search Foreclosures',
8
+ description: 'Search for foreclosure and pre-foreclosure properties on Zillow. Requires either a region_id (from search_locations) or map_bounds.',
9
+ summary: 'Find foreclosure properties',
10
+ icon: 'alert-triangle',
11
+ group: 'Search',
12
+ input: z.object({
13
+ region_id: z
14
+ .number()
15
+ .int()
16
+ .optional()
17
+ .describe('Zillow region ID (from search_locations). Required if map_bounds is not provided.'),
18
+ region_type: z
19
+ .string()
20
+ .optional()
21
+ .describe('Region type: "city", "county", "zipcode", "neighborhood" (default "city")'),
22
+ map_bounds: z
23
+ .object({
24
+ west: z.number().describe('Western longitude'),
25
+ east: z.number().describe('Eastern longitude'),
26
+ south: z.number().describe('Southern latitude'),
27
+ north: z.number().describe('Northern latitude'),
28
+ })
29
+ .optional()
30
+ .describe('Map bounding box. Required if region_id is not provided.'),
31
+ min_price: z.number().optional().describe('Minimum price in dollars'),
32
+ max_price: z.number().optional().describe('Maximum price in dollars'),
33
+ sort: z
34
+ .enum(['globalrelevanceex', 'days', 'pricea', 'priced'])
35
+ .optional()
36
+ .describe('Sort order (default "globalrelevanceex")'),
37
+ page: z.number().int().min(1).optional().describe('Page number (default 1)'),
38
+ }),
39
+ output: z.object({
40
+ total: z.number().describe('Total foreclosure listings'),
41
+ listings: z.array(listingSchema).describe('Foreclosure listings'),
42
+ }),
43
+ handle: async (params) => {
44
+ if (!params.region_id && !params.map_bounds) {
45
+ throw ToolError.validation('Either region_id or map_bounds is required.');
46
+ }
47
+ const filterState = {
48
+ isForSaleForeclosure: { value: true },
49
+ isForSaleByAgent: { value: false },
50
+ isForSaleByOwner: { value: false },
51
+ isNewConstruction: { value: false },
52
+ isComingSoon: { value: false },
53
+ isAuction: { value: false },
54
+ };
55
+ if (params.sort)
56
+ filterState.sortSelection = { value: params.sort };
57
+ if (params.min_price || params.max_price)
58
+ filterState.price = { min: params.min_price, max: params.max_price };
59
+ const bounds = params.map_bounds ?? { west: -122.5, east: -122.3, south: 37.7, north: 37.8 };
60
+ const data = await search({
61
+ pagination: params.page && params.page > 1 ? { currentPage: params.page } : undefined,
62
+ mapBounds: bounds,
63
+ regionSelection: params.region_id
64
+ ? [{ regionId: params.region_id, regionType: REGION_TYPE_MAP[params.region_type ?? 'city'] ?? 6 }]
65
+ : undefined,
66
+ filterState,
67
+ isMapVisible: true,
68
+ }, { cat1: ['listResults', 'total'] });
69
+ return {
70
+ total: data.categoryTotals?.cat1?.totalResultCount ?? data.cat1?.searchResults?.listResults?.length ?? 0,
71
+ listings: (data.cat1?.searchResults?.listResults ?? []).map(mapListing),
72
+ };
73
+ },
74
+ });
75
+ //# sourceMappingURL=search-foreclosures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-foreclosures.js","sourceRoot":"","sources":["../../src/tools/search-foreclosures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EA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,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;QAE/G,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAE7F,MAAM,IAAI,GAAG,MAAM,MAAM,CACvB;YACE,UAAU,EAAE,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;YACrF,SAAS,EAAE,MAAM;YACjB,eAAe,EAAE,MAAM,CAAC,SAAS;gBAC/B,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClG,CAAC,CAAC,SAAS;YACb,WAAW;YACX,YAAY,EAAE,IAAI;SACnB,EACD,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,EAAE,CACnC,CAAC;QAEF,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,gBAAgB,IAAI,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;YACxG,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;SACxE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const searchLocations: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
3
+ query: z.ZodString;
4
+ }, z.core.$strip>, z.ZodObject<{
5
+ locations: z.ZodArray<z.ZodObject<{
6
+ display: z.ZodString;
7
+ type: z.ZodString;
8
+ city: z.ZodString;
9
+ state: z.ZodString;
10
+ county: z.ZodString;
11
+ region_id: z.ZodNumber;
12
+ region_type: z.ZodString;
13
+ latitude: z.ZodNumber;
14
+ longitude: z.ZodNumber;
15
+ zpid: z.ZodNumber;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>>;
18
+ //# sourceMappingURL=search-locations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-locations.d.ts","sourceRoot":"","sources":["../../src/tools/search-locations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;kBAkB1B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { defineTool } from '@opentabs-dev/plugin-sdk';
2
+ import { z } from 'zod';
3
+ import { autocomplete } from '../zillow-api.js';
4
+ import { locationSchema, mapLocation } from './schemas.js';
5
+ export const searchLocations = defineTool({
6
+ name: 'search_locations',
7
+ displayName: 'Search Locations',
8
+ description: 'Search for cities, ZIP codes, neighborhoods, and addresses on Zillow. Returns location suggestions with region IDs that can be used with search tools. Use this to resolve a location name to a region_id before calling search_for_sale, search_for_rent, or search_recently_sold.',
9
+ summary: 'Search for cities, ZIP codes, neighborhoods, and addresses',
10
+ icon: 'map-pin',
11
+ group: 'Search',
12
+ input: z.object({
13
+ query: z.string().min(1).describe('Location search text (e.g., "San Francisco", "94107", "Mission District")'),
14
+ }),
15
+ output: z.object({
16
+ locations: z.array(locationSchema).describe('Matching locations'),
17
+ }),
18
+ handle: async (params) => {
19
+ const results = await autocomplete(params.query);
20
+ return { locations: results.map(mapLocation) };
21
+ },
22
+ });
23
+ //# sourceMappingURL=search-locations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-locations.js","sourceRoot":"","sources":["../../src/tools/search-locations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,qRAAqR;IACvR,OAAO,EAAE,4DAA4D;IACrE,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2EAA2E,CAAC;KAC/G,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC;KAClE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjD,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;IACjD,CAAC;CACF,CAAC,CAAC"}