dogpolicies-mcp 0.2.10 → 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.
- package/CHANGELOG.md +28 -0
- package/README.md +5 -3
- package/data/snapshot.json.gz +0 -0
- package/docs/tools.md +75 -7
- package/package.json +1 -1
- package/server.json +3 -3
- package/src/dogpolicies/i5.mjs +191 -0
- package/src/dogpolicies/prompts.mjs +23 -0
- package/src/dogpolicies/resources.mjs +49 -1
- package/src/dogpolicies/tools/get-place.mjs +38 -1
- package/src/dogpolicies/tools/i5-conditions.mjs +219 -0
- package/src/dogpolicies/tools/i5-corridor.mjs +315 -0
- package/src/dogpolicies/tools/index.mjs +4 -0
- package/src/dogpolicies/tools/plan-trip.mjs +93 -2
- package/src/dogpolicies/tools/route-stops.mjs +106 -7
- package/src/snapshot/build.mjs +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,34 @@ The data inside the package has its own date (`as_of` in every result). A
|
|
|
10
10
|
new package version ships a new snapshot; the server also refreshes from the
|
|
11
11
|
site on its own when the network allows.
|
|
12
12
|
|
|
13
|
+
## 0.3.0 - 2026-11-04
|
|
14
|
+
|
|
15
|
+
The I-5 axis: every I-5 stop in California carries its position on the I-5
|
|
16
|
+
centerline (s meters from San Ysidro, the same number the corridor JSON and
|
|
17
|
+
the simulator use) beside its Caltrans mile.
|
|
18
|
+
|
|
19
|
+
Added
|
|
20
|
+
|
|
21
|
+
- `dogpolicies_route_stops`: `ahead_miles` (a window from the start in the
|
|
22
|
+
direction of travel), `family` (only stops whose official source states
|
|
23
|
+
restrooms and a pet area or dog park) and `paired` (exits with people-stops
|
|
24
|
+
nearby, counted from OpenStreetMap and never named, matched to the nearest
|
|
25
|
+
dog-legal place). On I-5 every stop returns `s_m`, `miles_ahead`, `side`,
|
|
26
|
+
`off_miles`, `elevation_m`, `strip`, `restrooms`, `water`, `pet_area`,
|
|
27
|
+
`dog_park`, `hours` (with its source) and `family_stop`.
|
|
28
|
+
- `dogpolicies_i5_corridor`: the eleven stretches of I-5 in California with
|
|
29
|
+
their s and mile ranges, and the stops in a stretch, a mile range or a
|
|
30
|
+
window ahead of a point.
|
|
31
|
+
- `dogpolicies_i5_conditions`: Caltrans lane closures, road-weather readings,
|
|
32
|
+
message-sign text and chain-control status on I-5, fetched within the last
|
|
33
|
+
15 minutes and placed on the axis; conditions, not rules. Needs the network.
|
|
34
|
+
- `dogpolicies_get_place` returns `axis` and, for the dog side of a pairing,
|
|
35
|
+
`paired_stop`. `dogpolicies_plan_trip` returns `i5` (the drive leg's family
|
|
36
|
+
stops and paired stops) when the town is within 10 miles of I-5.
|
|
37
|
+
- Resource `dogpolicies://corridor/i-5`; prompt `drive_i5_with_dog`.
|
|
38
|
+
- The `hours` fact, in the source's own words.
|
|
39
|
+
- The snapshot carries the I-5 calibration table, strips and paired stops.
|
|
40
|
+
|
|
13
41
|
## 0.2.10 - 2026-11-04
|
|
14
42
|
|
|
15
43
|
- Listed in Claude's connector directory: the README and the install guide
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ npx dogpolicies-mcp demo
|
|
|
23
23
|
- Whether dogs are allowed at 2,400+ parks, beaches, trails, hotels, campgrounds, cabin resorts and restaurant patios, with leash rules, restrictions, weight limits and pet fees.
|
|
24
24
|
- Which hotel will take _your_ dog: weight, number of dogs, nights and a fee budget, with the fee arithmetic spelled out ("2 dogs x 3 nights x $25 per pet per night = $150, capped at $100 per stay").
|
|
25
25
|
- A whole trip in one call: where to stay with this dog, what to do, where to eat, near any town or county.
|
|
26
|
-
- Dog-friendly stops along I-5, US-101, Highway 1, I-15, I-80, US-50, US-95 and US-93, in driving order.
|
|
26
|
+
- Dog-friendly stops along I-5, US-101, Highway 1, I-15, I-80, US-50, US-95 and US-93, in driving order. On I-5 in California, every stop sits on the I-5 centerline (s meters from San Ysidro) with its side, elevation and stretch; the next family stop (restrooms and a pet area stated by the source) in N miles; paired exits; and Caltrans conditions right now.
|
|
27
27
|
- Hotel chain pet policies (Motel 6, Red Roof, Kimpton and more) and which properties are exceptions.
|
|
28
28
|
- Side-by-side comparisons, and what changed since a date, everywhere or near a town.
|
|
29
29
|
- Areas the way travelers name them: East Bay, Lake Tahoe, Big Sur, Yosemite, Death Valley, the Mendocino Coast and the Bay Area's metros, as a filter, a place name in `near` and `plan_trip`, and a resource.
|
|
@@ -154,7 +154,9 @@ The `demo` output is the exact text an assistant receives:
|
|
|
154
154
|
| `dogpolicies_find_hotels` | Hotels that take a specific dog: weight, number of dogs, nights, fee budget. Verdicts (match, possible, excluded), cheapest first, fee arithmetic shown. |
|
|
155
155
|
| `dogpolicies_get_brand_policy` | A chain's published pet policy, its listed exceptions and property counts. |
|
|
156
156
|
| `dogpolicies_browse_answers` | Ready-made answers to common questions ("Which California state parks allow dogs?"). |
|
|
157
|
-
| `dogpolicies_route_stops` | Dog stops along a highway by mile and direction: rest areas with pet areas, hotels, campgrounds, parks, beaches.
|
|
157
|
+
| `dogpolicies_route_stops` | Dog stops along a highway by mile and direction: rest areas with pet areas, hotels, campgrounds, parks, beaches. On I-5 in California: s meters from San Ysidro, side, elevation, family stops (restrooms and a pet area stated) and paired exits. |
|
|
158
|
+
| `dogpolicies_i5_corridor` | I-5 in California as eleven stretches on the I-5 centerline, and the stops in a stretch, a mile range or a window ahead of a point. |
|
|
159
|
+
| `dogpolicies_i5_conditions` | Caltrans closures, road weather, sign text and chain controls on I-5 right now, placed on the same axis; conditions, not rules. Needs the network. |
|
|
158
160
|
| `dogpolicies_get_rule` | One rule by its stable id, with source, quote, confidence, verified date and freshness. |
|
|
159
161
|
| `dogpolicies_changes_since` | Verification events and rule changes since a date, newest first. |
|
|
160
162
|
| `dogpolicies_changes_near` | The same, limited to a radius around a town or point. |
|
|
@@ -164,7 +166,7 @@ Every tool returns readable markdown by default and structured JSON (`response_f
|
|
|
164
166
|
|
|
165
167
|
### Resources and prompts
|
|
166
168
|
|
|
167
|
-
Resources let a client attach a record without a tool call: `dogpolicies://place/{id}`, `dogpolicies://brand/{id}`, `dogpolicies://answer/{slug}`, `dogpolicies://route/{id}`, `dogpolicies://area/{id}` (all with completion), plus `dogpolicies://about`, `dogpolicies://answers` and `dogpolicies://
|
|
169
|
+
Resources let a client attach a record without a tool call: `dogpolicies://place/{id}`, `dogpolicies://brand/{id}`, `dogpolicies://answer/{slug}`, `dogpolicies://route/{id}`, `dogpolicies://area/{id}` (all with completion), plus `dogpolicies://about`, `dogpolicies://answers`, `dogpolicies://status` and `dogpolicies://corridor/i-5` (the I-5 stretches and every stop by s). Prompts give a client's slash menu the common trips: `plan_dog_trip`, `check_hotel_for_dog`, `road_trip_with_dog`, `drive_i5_with_dog`, `what_can_my_dog_do_here`, `cite_a_rule`, with town-name completion.
|
|
168
170
|
|
|
169
171
|
## How the data stays current
|
|
170
172
|
|
package/data/snapshot.json.gz
CHANGED
|
Binary file
|
package/docs/tools.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tool reference
|
|
2
2
|
|
|
3
|
-
dogpolicies-mcp 0.
|
|
3
|
+
dogpolicies-mcp 0.3.0, generated by `node scripts/docs.mjs` from the live definitions. Every tool returns readable markdown by default and structured JSON with `response_format: "json"`; every result starts with a citation and ends with the attribution line.
|
|
4
4
|
|
|
5
5
|
## `dogpolicies_search_places`
|
|
6
6
|
|
|
@@ -70,7 +70,7 @@ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `cente
|
|
|
70
70
|
|
|
71
71
|
**Get place details** · since 0.1.0
|
|
72
72
|
|
|
73
|
-
The full record for one place you already know by id: every dog rule with its display text, the rules list, and each source with its URL, publisher, capture date and quote.
|
|
73
|
+
The full record for one place you already know by id: every dog rule with its display text, the rules list, and each source with its URL, publisher, capture date and quote. A place on I-5 in California also carries its axis position (s meters from San Ysidro on the I-5 centerline, Caltrans mile, meters off the road, side of northbound travel, road elevation, strip) and, when it is the dog side of a paired stop, that pair: the exit and the people-stops near it (counted from OpenStreetMap, never named, not verified for restrooms).
|
|
74
74
|
|
|
75
75
|
Takes a place id, as returned in every search result. Example: id="carmel-beach".
|
|
76
76
|
|
|
@@ -81,7 +81,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
|
|
|
81
81
|
| `id` (required) | string (min length 2, max length 120) | Place id, e.g. "fort-funston" |
|
|
82
82
|
| `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
|
|
83
83
|
|
|
84
|
-
Output fields: `id`, `uid`, `name`, `type`, `status`, `answer`, `citation`, `confidence`, `confirmed_by`, `freshness`, `verified_at`, `url`, `source_urls`, `record_license`, `as_of`, `license`, `attribution_text`, `attribution_url`, `facts`, `rule_records`, `not_stated`, `rules`, `sources`, `review_due` (more may be added; none removed).
|
|
84
|
+
Output fields: `id`, `uid`, `name`, `type`, `status`, `answer`, `citation`, `confidence`, `confirmed_by`, `freshness`, `verified_at`, `url`, `source_urls`, `record_license`, `as_of`, `license`, `attribution_text`, `attribution_url`, `facts`, `rule_records`, `not_stated`, `rules`, `sources`, `review_due`, `axis`, `paired_stop` (more may be added; none removed).
|
|
85
85
|
|
|
86
86
|
## `dogpolicies_compare_places`
|
|
87
87
|
|
|
@@ -104,7 +104,7 @@ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `place
|
|
|
104
104
|
|
|
105
105
|
**Plan a trip with a dog** · since 0.2.0
|
|
106
106
|
|
|
107
|
-
Plan a stay in a California or Nevada town with a dog, in one call: where to stay (hotels, campgrounds and cabins that will take this dog, with the pet fee for the whole stay worked out), what to do (beaches, parks and trails that allow dogs, nearest first) and where to eat (patios that take dogs), every item with its citation.
|
|
107
|
+
Plan a stay in a California or Nevada town with a dog, in one call: where to stay (hotels, campgrounds and cabins that will take this dog, with the pet fee for the whole stay worked out), what to do (beaches, parks and trails that allow dogs, nearest first) and where to eat (patios that take dogs), every item with its citation. When the town is within 10 miles of I-5 in California, the result also carries the drive leg on the I-5 axis: the town's position (Caltrans mile and s meters from San Ysidro), the next family stops (restrooms and a pet area or dog park stated by their official source) in each direction within 60 miles, and the paired stops (an exit with people-stops nearby, counted from OpenStreetMap and never named, matched to the nearest dog-legal place) within 10 miles.
|
|
108
108
|
|
|
109
109
|
Inputs: the town or county and the dog: weight, how many dogs, nights, and the most the user will pay in pet fees.
|
|
110
110
|
|
|
@@ -129,7 +129,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
|
|
|
129
129
|
| `per_section` | integer (min 1, max 15, default `5`) | Results per section |
|
|
130
130
|
| `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
|
|
131
131
|
|
|
132
|
-
Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `label`, `radius_miles`, `asked`, `stays`, `stay_counts`, `outings` (more may be added; none removed).
|
|
132
|
+
Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `label`, `radius_miles`, `asked`, `stays`, `stay_counts`, `outings`, `i5` (more may be added; none removed).
|
|
133
133
|
|
|
134
134
|
## `dogpolicies_find_hotels`
|
|
135
135
|
|
|
@@ -211,13 +211,17 @@ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `total
|
|
|
211
211
|
|
|
212
212
|
Dog-friendly stops along a California or Nevada highway, in driving order: rest areas (Caltrans rest areas with pet areas; Nevada rest areas, where leashed dogs are allowed), travel stops with dog parks, hotels, cabin resorts and campgrounds or RV parks near the road (all checked against the dog's weight and the pet-fee budget) and parks or beaches that allow dogs.
|
|
213
213
|
|
|
214
|
-
Each stop has its mile on the route and its distance off the road. Each route covers one state and stops at the state line. California miles follow the Caltrans odometer: north on I-5 (from the Mexican border), US-101 (from Los Angeles), Highway 1 (from Dana Point) and I-15 (i-15, San Diego to Primm); east on I-80 (i-80, San Francisco to the Nevada line) and US-50 (us-50, West Sacramento to Stateline). Nevada routes count Nevada mileposts from the California line, matching the exit numbers: north on I-15 (i-15-nevada), east on I-80 (i-80-nevada) and US-50 (us-50-nevada, Stateline to Utah); north on US-95 (us-95-nevada, California line to Oregon) and US-93 (us-93-nevada, Hoover Dam to Idaho), whose miles include the stretches they share with other highways. Where Highway 1 runs on US-101, stops on that stretch say so in on_road. A starting point is set with from_mile or near, plus a direction.
|
|
214
|
+
Each stop has its mile on the route and its distance off the road. Each route covers one state and stops at the state line. California miles follow the Caltrans odometer: north on I-5 (from the Mexican border), US-101 (from Los Angeles), Highway 1 (from Dana Point) and I-15 (i-15, San Diego to Primm); east on I-80 (i-80, San Francisco to the Nevada line) and US-50 (us-50, West Sacramento to Stateline). Nevada routes count Nevada mileposts from the California line, matching the exit numbers: north on I-15 (i-15-nevada), east on I-80 (i-80-nevada) and US-50 (us-50-nevada, Stateline to Utah); north on US-95 (us-95-nevada, California line to Oregon) and US-93 (us-93-nevada, Hoover Dam to Idaho), whose miles include the stretches they share with other highways. Where Highway 1 runs on US-101, stops on that stretch say so in on_road. A starting point is set with from_mile or near, plus a direction; ahead_miles limits the window to that many miles from the start in the direction of travel.
|
|
215
|
+
|
|
216
|
+
On I-5 in California each stop also carries its position on the I-5 centerline in meters from San Ysidro (s_m), miles_ahead of the start along the direction of travel, the side of the road it serves (right or left of northbound travel, or both), its distance off the freeway, the road's elevation in meters and the stretch (strip) it is in, plus restrooms, water, pet_area, dog_park and hours as its official source states them. With family=true only stops whose official source states restrooms and a pet area or dog park are returned. With paired=true the result also lists paired stops: a freeway exit in the window with places to stop for people nearby (located through OpenStreetMap, counted by kind, never named and not verified for restrooms) matched to the nearest DogPolicies place that allows dogs within about a mile, with its rule and source.
|
|
215
217
|
|
|
216
218
|
Routes covered: I-5 (i-5, 796 miles), US-101 (us-101, 809 miles), Highway 1 (highway-1, 736 miles), I-15 (i-15, 294 miles), I-80 (i-80, 204 miles), US-50 (us-50, 109 miles), I-15 (i-15-nevada, 124 miles), I-80 (i-80-nevada, 410 miles), US-50 (us-50-nevada, 409 miles), US-95 (us-95-nevada, 664 miles), US-93 (us-93-nevada, 526 miles).
|
|
217
219
|
|
|
218
220
|
Examples:
|
|
219
221
|
- "Driving north on I-5 from Los Angeles with a 70 lb dog, where can we stop?" -> near={lat:34.05, lon:-118.24}, direction="north", dog_weight_lb=70
|
|
220
222
|
- "Pet areas on the Grapevine" -> from_mile=170, to_mile=222, kinds=["rest_area","park"]
|
|
223
|
+
- "Next place in 40 miles where the whole family can use a restroom, dog included, northbound at Harris Ranch" -> near={lat:36.25, lon:-120.25}, direction="north", ahead_miles=40, family=true
|
|
224
|
+
- "Exits with a coffee shop and a park for the dog between Sacramento and Redding" -> from_mile=520, to_mile=680, paired=true
|
|
221
225
|
- "Heading south on 101 from San Francisco to Santa Barbara, where can the dog run?" -> route="us-101", near={lat:37.77, lon:-122.42}, to_mile=100, direction="south"
|
|
222
226
|
- "Dog-friendly hotel near Redding under $40 a night" -> near={lat:40.59, lon:-122.39}, kinds=["lodging"], max_total_fee=40
|
|
223
227
|
- "Driving I-80 east from Reno with a dog, where can we stop?" -> route="i-80-nevada", near={lat:39.53, lon:-119.81}, direction="east"
|
|
@@ -230,8 +234,11 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
|
|
|
230
234
|
| `near` | object | Start from the route mile nearest this point |
|
|
231
235
|
| `from_mile` | number (min 0, max 1000) | Start at this route mile |
|
|
232
236
|
| `to_mile` | number (min 0, max 1000) | Stop at this route mile |
|
|
237
|
+
| `ahead_miles` | number (min 1, max 1000) | Window in miles from the start (near or from_mile) in the direction of travel; an alternative to to_mile |
|
|
233
238
|
| `direction` | `north`, `south`, `east`, `west` (default `"north"`) | Direction of travel. Route miles increase going north, or east on I-80 and US-50; north and east both mean increasing miles |
|
|
234
239
|
| `kinds` | array of `rest_area`, `stop`, `lodging`, `campground`, `cabins`, `park`, `beach`, `trail`, `restaurant` | Kinds of stops to include; all by default |
|
|
240
|
+
| `family` | boolean (default `false`) | Only stops whose official source states restrooms and a pet area or dog park (I-5 in California) |
|
|
241
|
+
| `paired` | boolean (default `false`) | Also list the paired stops in the window: an exit with people-stops nearby and the nearest dog-legal place (I-5 in California) |
|
|
235
242
|
| `dog_friendly_only` | boolean (default `true`) | Leave out stops where dogs are not allowed |
|
|
236
243
|
| `dog_weight_lb` | number (min 1, max 250) | The dog's weight in pounds |
|
|
237
244
|
| `dogs` | integer (min 1, max 4, default `1`) | Number of dogs |
|
|
@@ -241,7 +248,66 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
|
|
|
241
248
|
| `offset` | integer (min 0, max 9007199254740991, default `0`) | Results to skip, for pagination |
|
|
242
249
|
| `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
|
|
243
250
|
|
|
244
|
-
Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `total`, `count`, `offset`, `has_more`, `stops`, `route`, `guide` (more may be added; none removed).
|
|
251
|
+
Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `total`, `count`, `offset`, `has_more`, `stops`, `route`, `guide`, `start`, `paired_stops` (more may be added; none removed).
|
|
252
|
+
|
|
253
|
+
## `dogpolicies_i5_corridor`
|
|
254
|
+
|
|
255
|
+
**I-5 corridor by stretch** · since 0.3.0
|
|
256
|
+
|
|
257
|
+
The I-5 corridor in California as eleven named stretches (strips) on the I-5 centerline, from San Ysidro (s = 0 m) to the Oregon line (s ≈ 1,281,400 m), and the dog stops in any stretch, mile range or window ahead of a point. Every stop carries its s in meters from San Ysidro, its Caltrans odometer mile, the side of the road it serves (right or left of northbound travel, or both), its distance off the freeway, the road's elevation, and restrooms, water, pet area, dog park and hours as its official source states them. A family stop is one whose official source states restrooms and a pet area or dog park. A paired stop is a freeway exit with places to stop for people nearby (located through OpenStreetMap, counted by kind, never named and not verified for restrooms) matched to the nearest DogPolicies place that allows dogs within about a mile, with its rule and source.
|
|
258
|
+
|
|
259
|
+
With no stretch, miles or point, the result is the list of stretches with their s and mile ranges and stop counts. Strips: sandiego (San Ysidro → Camp Pendleton), orange-la (Camp Pendleton → East LA), grapevine (East LA → Wheeler Ridge), kern-westside (Wheeler Ridge → Kettleman), westside (Kettleman → Santa Nella), delta (Santa Nella → Stockton), sacramento (Stockton → Woodland), valley (Woodland → Williams), tehama (Williams → Red Bluff), shasta (Red Bluff → Mt Shasta), siskiyou (Mt Shasta → Siskiyou Summit).
|
|
260
|
+
|
|
261
|
+
Examples:
|
|
262
|
+
- "What is between the Grapevine and Kettleman?" -> strip="grapevine" (East LA to Wheeler Ridge) and strip="kern-westside" (Wheeler Ridge to Kettleman)
|
|
263
|
+
- "The next 5 family stops northbound from Stockton" -> near={lat:37.95, lon:-121.29}, direction="north", family=true, limit=5
|
|
264
|
+
- "Every stop between mile 300 and 340" -> from_mile=300, to_mile=340
|
|
265
|
+
- "Exits with somewhere for people and a park for the dog in the Sacramento stretch" -> strip="sacramento", paired=true
|
|
266
|
+
|
|
267
|
+
Annotations: read-only true, destructive false, idempotent true, open-world false.
|
|
268
|
+
|
|
269
|
+
| Input | Type | Meaning |
|
|
270
|
+
|---|---|---|
|
|
271
|
+
| `strip` | `sandiego`, `orange-la`, `grapevine`, `kern-westside`, `westside`, `delta`, `sacramento`, `valley`, `tehama`, `shasta`, `siskiyou` | A stretch by id (sandiego, orange-la, grapevine, kern-westside, westside, delta, sacramento, valley, tehama, shasta, siskiyou) |
|
|
272
|
+
| `from_mile` | number (min 0, max 800) | Start of a mile range (Caltrans odometer) |
|
|
273
|
+
| `to_mile` | number (min 0, max 800) | End of a mile range |
|
|
274
|
+
| `near` | object | A point on or near I-5; the window starts at the nearest point of the road |
|
|
275
|
+
| `direction` | `north`, `south` (default `"north"`) | Direction of travel from near; north means increasing s |
|
|
276
|
+
| `ahead_miles` | number (min 1, max 800, default `50`) | Window in miles from near in the direction of travel |
|
|
277
|
+
| `kinds` | array of `rest_area`, `stop`, `lodging`, `campground`, `cabins`, `park`, `beach`, `trail`, `restaurant` | Kinds of stops to include; all by default |
|
|
278
|
+
| `family` | boolean (default `false`) | Only family stops |
|
|
279
|
+
| `paired` | boolean (default `false`) | Also list the paired stops in the window |
|
|
280
|
+
| `dog_friendly_only` | boolean (default `true`) | Leave out stops where dogs are not allowed |
|
|
281
|
+
| `limit` | integer (min 1, max 50, default `15`) | Maximum stops to return |
|
|
282
|
+
| `offset` | integer (min 0, max 9007199254740991, default `0`) | Stops to skip |
|
|
283
|
+
| `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
|
|
284
|
+
|
|
285
|
+
Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `axis_version`, `strips`, `window`, `total`, `stops`, `paired_stops` (more may be added; none removed).
|
|
286
|
+
|
|
287
|
+
## `dogpolicies_i5_conditions`
|
|
288
|
+
|
|
289
|
+
**I-5 conditions now** · since 0.3.0
|
|
290
|
+
|
|
291
|
+
Current Caltrans lane closures, road-weather station readings, changeable-message-sign text and chain-control status on I-5 in California, each placed on the I-5 centerline (s meters from San Ysidro and the Caltrans mile) and matched to the nearest DogPolicies dog stop. Conditions come from Caltrans' CWWP2 feeds fetched within the last 15 minutes (fetched_at in the result) and are not verified rules.
|
|
292
|
+
|
|
293
|
+
The window is a mile range (from_mile, to_mile) or a point with a direction and ahead_miles; with none, the whole of I-5 in California. Needs the network (the document is read from dogpolicies.com); offline the result is an error with code offline.
|
|
294
|
+
|
|
295
|
+
Examples:
|
|
296
|
+
- "Is there a closure or chains on the Grapevine right now?" -> from_mile=170, to_mile=222
|
|
297
|
+
- "Weather and closures in the next 60 miles northbound from Redding" -> near={lat:40.59, lon:-122.39}, direction="north", ahead_miles=60
|
|
298
|
+
|
|
299
|
+
Annotations: read-only true, destructive false, idempotent true, open-world false.
|
|
300
|
+
|
|
301
|
+
| Input | Type | Meaning |
|
|
302
|
+
|---|---|---|
|
|
303
|
+
| `from_mile` | number (min 0, max 800) | Start of a mile range |
|
|
304
|
+
| `to_mile` | number (min 0, max 800) | End of a mile range |
|
|
305
|
+
| `near` | object | A point on or near I-5 |
|
|
306
|
+
| `direction` | `north`, `south` (default `"north"`) | Direction of travel from near |
|
|
307
|
+
| `ahead_miles` | number (min 1, max 800, default `50`) | Window in miles from near |
|
|
308
|
+
| `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
|
|
309
|
+
|
|
310
|
+
Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `fetched_at`, `notice`, `window`, `chains_in_effect`, `closures`, `weather`, `signs`, `chain_controls`, `source` (more may be added; none removed).
|
|
245
311
|
|
|
246
312
|
## `dogpolicies_get_rule`
|
|
247
313
|
|
|
@@ -327,6 +393,7 @@ Output fields: `report_id`, `place_id`, `status`, `url` (more may be added; none
|
|
|
327
393
|
| `dogpolicies://brand/{id}` | A chain's published pet policy, exceptions and property counts | text/markdown |
|
|
328
394
|
| `dogpolicies://answer/{slug}` | The places that answer one ready-made question | text/markdown |
|
|
329
395
|
| `dogpolicies://route/{id}` | Dog-friendly stops along one highway in driving order | text/markdown |
|
|
396
|
+
| `dogpolicies://corridor/i-5` | I-5 in California as eleven stretches on the I-5 centerline (s meters from San Ysidro), with every dog stop at its s, the family stops and the paired stops | application/json |
|
|
330
397
|
| `dogpolicies://area/{id}` | Every dog-related place in one area (East Bay, Lake Tahoe, Big Sur), grouped by kind | text/markdown |
|
|
331
398
|
|
|
332
399
|
Templates support completion (`completion/complete`) for their variable.
|
|
@@ -338,5 +405,6 @@ Templates support completion (`completion/complete`) for their variable.
|
|
|
338
405
|
| `plan_dog_trip` | A stay in a California or Nevada town: where to stay with this dog, what to do, where to eat, with sources | `destination`, `dog`, `nights`, `budget` |
|
|
339
406
|
| `check_hotel_for_dog` | Check one hotel or a town's hotels against a specific dog: weight, count, nights, fee | `hotel_or_town`, `dog_weight_lb`, `dogs`, `nights` |
|
|
340
407
|
| `road_trip_with_dog` | Dog-friendly stops along a highway in driving order: rest areas, parks, hotels within budget | `route`, `from`, `direction`, `dog_weight_lb` |
|
|
408
|
+
| `drive_i5_with_dog` | The drive on I-5 in California: the next family stops (restrooms and a pet area) and paired exits ahead, with conditions now | `from`, `direction`, `ahead_miles` |
|
|
341
409
|
| `what_can_my_dog_do_here` | Beaches, parks, trails, patios and stays near a town, with the rule for each | `place` |
|
|
342
410
|
| `cite_a_rule` | The official rule for one place with the quoted source text, ready to cite | `place_id` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dogpolicies-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "MCP server for verified dog rules at California and Nevada parks, beaches, trails, hotels, campgrounds and restaurant patios: leash rules, pet fees, weight limits, trip planning, every fact with its official source and the date it was checked.",
|
|
5
5
|
"mcpName": "io.github.xultrax-web/dogpolicies-mcp",
|
|
6
6
|
"type": "module",
|
package/server.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"url": "https://github.com/xultrax-web/dogpolicies-mcp",
|
|
9
9
|
"source": "github"
|
|
10
10
|
},
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.3.0",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "dogpolicies-mcp",
|
|
17
|
-
"version": "0.
|
|
17
|
+
"version": "0.3.0",
|
|
18
18
|
"runtimeHint": "npx",
|
|
19
19
|
"transport": {
|
|
20
20
|
"type": "stdio"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tool": "dogpolicies-release",
|
|
49
49
|
"license": "code MIT; data CC BY 4.0 (chain-hotel names and locations ODbL)",
|
|
50
50
|
"coverage": "California and Nevada",
|
|
51
|
-
"tools":
|
|
51
|
+
"tools": 15
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// The I-5 axis as the package sees it: the snapshot's routes["i-5"].axis
|
|
2
|
+
// carries the calibration table (Caltrans odometer mile <-> s meters from
|
|
3
|
+
// San Ysidro), the 11 California strips and the paired stops; every I-5 stop
|
|
4
|
+
// carries s_m, axis_side, elevation_m and strip. This module turns those into
|
|
5
|
+
// the windows and rows the tools return. Pure: no I/O.
|
|
6
|
+
|
|
7
|
+
import { nearestOnLine } from "../core/geo.mjs";
|
|
8
|
+
|
|
9
|
+
export const MILE_M = 1609.344;
|
|
10
|
+
export const I5 = "i-5";
|
|
11
|
+
|
|
12
|
+
/** The axis block of a route, or null when the route has none. */
|
|
13
|
+
export const axisOf = (route) => route?.axis ?? null;
|
|
14
|
+
|
|
15
|
+
/** Piecewise-linear interpolation over the calibration table, both ways. */
|
|
16
|
+
export function calibrationOf(axis) {
|
|
17
|
+
const miles = axis.calibration.map((r) => r[0]);
|
|
18
|
+
const ss = axis.calibration.map((r) => r[1]);
|
|
19
|
+
const n = miles.length;
|
|
20
|
+
const interp = (xs, ys, x) => {
|
|
21
|
+
if (x <= xs[0]) return ys[0] + ((x - xs[0]) * (ys[1] - ys[0])) / (xs[1] - xs[0]);
|
|
22
|
+
if (x >= xs[n - 1])
|
|
23
|
+
return ys[n - 1] + ((x - xs[n - 1]) * (ys[n - 1] - ys[n - 2])) / (xs[n - 1] - xs[n - 2]);
|
|
24
|
+
let lo = 0;
|
|
25
|
+
let hi = n - 1;
|
|
26
|
+
while (hi - lo > 1) {
|
|
27
|
+
const mid = (lo + hi) >> 1;
|
|
28
|
+
if (xs[mid] <= x) lo = mid;
|
|
29
|
+
else hi = mid;
|
|
30
|
+
}
|
|
31
|
+
const span = xs[hi] - xs[lo];
|
|
32
|
+
return span ? ys[lo] + ((x - xs[lo]) * (ys[hi] - ys[lo])) / span : ys[lo];
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
sToMile: (s) => interp(ss, miles, s),
|
|
36
|
+
mileToS: (mile) => interp(miles, ss, mile),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The strip whose [startS, endS) holds s (strips overlap; the first wins). */
|
|
41
|
+
export function stripAt(axis, s) {
|
|
42
|
+
for (const st of axis.strips) if (s >= st.startS && s < st.endS) return st;
|
|
43
|
+
return s >= axis.strips.at(-1).endS ? axis.strips.at(-1) : axis.strips[0];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A strip by id or by a word of its name ("grapevine", "Kettleman"). */
|
|
47
|
+
export function findStrip(axis, text) {
|
|
48
|
+
const q = (text ?? "").toLowerCase().trim();
|
|
49
|
+
if (!q) return null;
|
|
50
|
+
return (
|
|
51
|
+
axis.strips.find((st) => st.id === q) ??
|
|
52
|
+
axis.strips.find((st) => st.name.toLowerCase().includes(q)) ??
|
|
53
|
+
null
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Where a point is on I-5: snap to the route's Caltrans line for the mile,
|
|
59
|
+
* then the calibration table for s. { mile, s, off_miles } or null when the
|
|
60
|
+
* point is more than `maxOffMiles` from the road.
|
|
61
|
+
*/
|
|
62
|
+
export function positionOf(route, near, { maxOffMiles = 25 } = {}) {
|
|
63
|
+
const axis = axisOf(route);
|
|
64
|
+
if (!axis || !near) return null;
|
|
65
|
+
const at = nearestOnLine(route.points, near);
|
|
66
|
+
if (at.mile == null || at.offMiles > maxOffMiles) return null;
|
|
67
|
+
const cal = calibrationOf(axis);
|
|
68
|
+
return {
|
|
69
|
+
mile: Math.round(at.mile * 10) / 10,
|
|
70
|
+
s: Math.round(cal.mileToS(at.mile)),
|
|
71
|
+
off_miles: Math.round(at.offMiles * 10) / 10,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const hasRestrooms = (p) =>
|
|
76
|
+
(p.facts?.amenities?.value ?? []).some((a) => /restroom/i.test(a));
|
|
77
|
+
const hasWater = (p) =>
|
|
78
|
+
(p.facts?.amenities?.value ?? []).some((a) => /water/i.test(a));
|
|
79
|
+
|
|
80
|
+
/** Restrooms stated, a pet area or dog park stated, dogs allowed, open. */
|
|
81
|
+
export const isFamilyStop = (p) =>
|
|
82
|
+
hasRestrooms(p) &&
|
|
83
|
+
Boolean(p.facts?.petArea?.value || p.facts?.dogPark?.value) &&
|
|
84
|
+
["yes", "yes_restricted"].includes(p.status) &&
|
|
85
|
+
(p.operating_status ?? "open") === "open";
|
|
86
|
+
|
|
87
|
+
/** The hours fact with its source, or null. */
|
|
88
|
+
export function hoursOf(p) {
|
|
89
|
+
const row = (p.rows ?? []).find((r) => r.key === "hours");
|
|
90
|
+
if (!row) return null;
|
|
91
|
+
const src = (p.sources ?? [])[row.source - 1];
|
|
92
|
+
return { text: row.value, source_url: src?.url ?? null, checked: src?.checked ?? null };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The axis fields for a stop row: s, miles ahead of a start (signed along
|
|
97
|
+
* the direction of travel), side, distance off, elevation, and the family
|
|
98
|
+
* facts with their sources.
|
|
99
|
+
*/
|
|
100
|
+
export function axisFields(stop, { startS = null, ahead = true } = {}) {
|
|
101
|
+
const p = stop.place;
|
|
102
|
+
const out = {
|
|
103
|
+
s_m: stop.s_m ?? null,
|
|
104
|
+
miles_ahead:
|
|
105
|
+
stop.s_m != null && startS != null
|
|
106
|
+
? Math.round((((ahead ? 1 : -1) * (stop.s_m - startS)) / MILE_M) * 10) / 10
|
|
107
|
+
: null,
|
|
108
|
+
side: stop.axis_side ?? null,
|
|
109
|
+
off_miles: stop.off_miles ?? null,
|
|
110
|
+
elevation_m: stop.elevation_m ?? null,
|
|
111
|
+
strip: stop.strip ?? null,
|
|
112
|
+
restrooms: hasRestrooms(p),
|
|
113
|
+
water: hasWater(p),
|
|
114
|
+
pet_area: Boolean(p.facts?.petArea?.value),
|
|
115
|
+
dog_park: Boolean(p.facts?.dogPark?.value),
|
|
116
|
+
hours: hoursOf(p),
|
|
117
|
+
family_stop: isFamilyStop(p),
|
|
118
|
+
};
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** True when the stop serves travel in this direction (ahead = northbound). */
|
|
123
|
+
export const servesDirection = (stop, ahead) =>
|
|
124
|
+
!stop.axis_side ||
|
|
125
|
+
stop.axis_side === "both" ||
|
|
126
|
+
stop.axis_side === (ahead ? "right" : "left");
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The window of stops from a start s in a direction: ahead means increasing
|
|
130
|
+
* s. `aheadMiles` null means to the end of the route.
|
|
131
|
+
*/
|
|
132
|
+
export function windowStops(route, { startS, ahead, aheadMiles = null }) {
|
|
133
|
+
const axis = axisOf(route);
|
|
134
|
+
const end = ahead
|
|
135
|
+
? aheadMiles == null
|
|
136
|
+
? Infinity
|
|
137
|
+
: startS + aheadMiles * MILE_M
|
|
138
|
+
: aheadMiles == null
|
|
139
|
+
? -Infinity
|
|
140
|
+
: startS - aheadMiles * MILE_M;
|
|
141
|
+
const inWindow = (s) =>
|
|
142
|
+
ahead ? s > startS && s <= end : s < startS && s >= end;
|
|
143
|
+
const rows = route.stops.filter(
|
|
144
|
+
(x) => x.s_m != null && inWindow(x.s_m) && servesDirection(x, ahead),
|
|
145
|
+
);
|
|
146
|
+
rows.sort((a, b) => (ahead ? a.s_m - b.s_m : b.s_m - a.s_m));
|
|
147
|
+
void axis;
|
|
148
|
+
return rows;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** The paired stops whose exit lies in [lo, hi] s, in s order. */
|
|
152
|
+
export function pairedIn(axis, lo, hi) {
|
|
153
|
+
return (axis.paired ?? []).filter((p) => p.exit.s >= lo && p.exit.s <= hi);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** The sentence for a pair's people side: counts and kinds, never a name. */
|
|
157
|
+
export function peopleStopsText(c) {
|
|
158
|
+
const parts = [];
|
|
159
|
+
if (c.cafe) parts.push(c.cafe === 1 ? "a coffee shop" : `${c.cafe} coffee shops`);
|
|
160
|
+
if (c.fast_food)
|
|
161
|
+
parts.push(c.fast_food === 1 ? "a fast-food place" : `${c.fast_food} fast-food places`);
|
|
162
|
+
if (c.fuel) parts.push(c.fuel === 1 ? "a gas station" : `${c.fuel} gas stations`);
|
|
163
|
+
const list =
|
|
164
|
+
parts.length > 1 ? `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}` : (parts[0] ?? "nothing");
|
|
165
|
+
return `${list} within half a mile of the exit (locations from OpenStreetMap; restrooms not verified)`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** A pair as a tool returns it, with the dog-stop's current freshness-free summary fields. */
|
|
169
|
+
export function pairRow(pair, graph) {
|
|
170
|
+
const p = graph.placeById.get(pair.dogStop.placeId);
|
|
171
|
+
return {
|
|
172
|
+
exit: pair.exit,
|
|
173
|
+
people_stops: { ...pair.peopleStops, restrooms: "unverified", source: "OpenStreetMap" },
|
|
174
|
+
dog_stop: {
|
|
175
|
+
...pair.dogStop,
|
|
176
|
+
url: p?.url ?? null,
|
|
177
|
+
markdown_url: p?.markdown_url ?? null,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** The markdown line for a pair. */
|
|
183
|
+
export function pairLine(row) {
|
|
184
|
+
const d = row.dog_stop;
|
|
185
|
+
const leash =
|
|
186
|
+
d.leash === "required" ? ", on leash" : d.leash?.startsWith("off_leash") ? ", off leash" : "";
|
|
187
|
+
return [
|
|
188
|
+
`- Exit ${row.exit.ref}${row.exit.name ? ` (${row.exit.name})` : ""}, mile ${row.exit.mile.toFixed(1)} (s ${row.exit.s.toLocaleString("en-US")} m): ${peopleStopsText(row.people_stops)}.`,
|
|
189
|
+
` Dogs: ${d.name}, about ${d.walkMin} minute${d.walkMin === 1 ? "" : "s"} on foot (${(d.distM / MILE_M).toFixed(1)} mi), ${d.answer === "yes" ? "dogs allowed" : "allowed with restrictions"}${leash}. ${d.citation}`,
|
|
190
|
+
].join("\n");
|
|
191
|
+
}
|
|
@@ -108,6 +108,29 @@ export const prompts = (ctx) => {
|
|
|
108
108
|
),
|
|
109
109
|
],
|
|
110
110
|
},
|
|
111
|
+
{
|
|
112
|
+
name: "drive_i5_with_dog",
|
|
113
|
+
title: "Driving I-5 with my dog",
|
|
114
|
+
description:
|
|
115
|
+
"The drive on I-5 in California: the next family stops (restrooms and a pet area) and paired exits ahead, with conditions now",
|
|
116
|
+
argsSchema: {
|
|
117
|
+
from: town("Where the drive starts on I-5, e.g. \"Stockton\" or \"Bakersfield\""),
|
|
118
|
+
direction: completable(
|
|
119
|
+
z.string().max(5).describe("north or south"),
|
|
120
|
+
() => ["north", "south"],
|
|
121
|
+
),
|
|
122
|
+
ahead_miles: z
|
|
123
|
+
.string()
|
|
124
|
+
.max(4)
|
|
125
|
+
.optional()
|
|
126
|
+
.describe("How far ahead to look, in miles (default 60)"),
|
|
127
|
+
},
|
|
128
|
+
build: ({ from, direction, ahead_miles }) => [
|
|
129
|
+
user(
|
|
130
|
+
`I am driving ${direction} on I-5 from ${from} with my dog and need the next places where the whole family can use a restroom, the dog included. Call dogpolicies_near with place="${from}" to get the starting point, then dogpolicies_route_stops with route="i-5", near set to that point, direction="${direction}", ahead_miles=${ahead_miles || 60}, family=true and paired=true. Then call dogpolicies_i5_conditions with the same near, direction and ahead_miles. List the family stops in driving order with miles ahead, side, hours and water as stated; then the paired exits, saying plainly that the people-stops come from OpenStreetMap and are not verified for restrooms; then any closure, chain control or sign text in the window with the time it was fetched. ${CITE}`,
|
|
131
|
+
),
|
|
132
|
+
],
|
|
133
|
+
},
|
|
111
134
|
{
|
|
112
135
|
name: "what_can_my_dog_do_here",
|
|
113
136
|
title: "What can my dog do here?",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// dogpolicies://brand/{id} one brand policy
|
|
10
10
|
// dogpolicies://answer/{slug} one answered question's places
|
|
11
11
|
// dogpolicies://route/{id} one highway's dog stops
|
|
12
|
+
// dogpolicies://corridor/i-5 the I-5 corridor: strips and stops by s
|
|
12
13
|
|
|
13
14
|
import { BRAND, PACKAGE_NAME, PACKAGE_VERSION } from "../config.mjs";
|
|
14
15
|
import { tools } from "./tools/index.mjs";
|
|
@@ -54,7 +55,7 @@ export const resources = (ctx) => [
|
|
|
54
55
|
"",
|
|
55
56
|
"## Resources",
|
|
56
57
|
"",
|
|
57
|
-
"- dogpolicies://place/{id}, dogpolicies://brand/{id}, dogpolicies://answer/{slug}, dogpolicies://route/{id}, dogpolicies://area/{id}, dogpolicies://answers, dogpolicies://status",
|
|
58
|
+
"- dogpolicies://place/{id}, dogpolicies://brand/{id}, dogpolicies://answer/{slug}, dogpolicies://route/{id}, dogpolicies://area/{id}, dogpolicies://corridor/i-5, dogpolicies://answers, dogpolicies://status",
|
|
58
59
|
"",
|
|
59
60
|
"## Areas",
|
|
60
61
|
"",
|
|
@@ -206,6 +207,53 @@ export const resources = (ctx) => [
|
|
|
206
207
|
return r.isError ? null : { text: r.content[0].text };
|
|
207
208
|
},
|
|
208
209
|
},
|
|
210
|
+
{
|
|
211
|
+
name: "corridor-i5",
|
|
212
|
+
uri: "dogpolicies://corridor/i-5",
|
|
213
|
+
title: "I-5 corridor",
|
|
214
|
+
description:
|
|
215
|
+
"I-5 in California as eleven stretches on the I-5 centerline (s meters from San Ysidro), with every dog stop at its s, the family stops and the paired stops",
|
|
216
|
+
mimeType: JSON_TYPE,
|
|
217
|
+
cacheHint: { ttlMs: 3_600_000, cacheScope: "public" },
|
|
218
|
+
read: () => {
|
|
219
|
+
const route = ctx.graph.routes["i-5"];
|
|
220
|
+
const axis = route?.axis;
|
|
221
|
+
if (!axis) return null;
|
|
222
|
+
const stops = route.stops
|
|
223
|
+
.filter((s) => s.s_m != null)
|
|
224
|
+
.map((s) => ({
|
|
225
|
+
id: s.place.id,
|
|
226
|
+
name: s.place.name,
|
|
227
|
+
type: s.place.type,
|
|
228
|
+
s_m: s.s_m,
|
|
229
|
+
mile: s.mile,
|
|
230
|
+
side: s.axis_side,
|
|
231
|
+
off_miles: s.off_miles,
|
|
232
|
+
elevation_m: s.elevation_m,
|
|
233
|
+
strip: s.strip,
|
|
234
|
+
status: s.place.status,
|
|
235
|
+
url: s.place.url,
|
|
236
|
+
}));
|
|
237
|
+
return {
|
|
238
|
+
text: JSON.stringify(
|
|
239
|
+
{
|
|
240
|
+
route: "i-5",
|
|
241
|
+
axis_version: axis.version,
|
|
242
|
+
origin: axis.origin,
|
|
243
|
+
ca_end_s: axis.ca_end_s,
|
|
244
|
+
strips: axis.strips,
|
|
245
|
+
stops,
|
|
246
|
+
paired_stops: axis.paired,
|
|
247
|
+
osm_note:
|
|
248
|
+
"Exit numbers, names and people-stop counts are OpenStreetMap data (ODbL, (c) OpenStreetMap contributors); restrooms at a people-stop are not verified.",
|
|
249
|
+
as_of: ctx.graph.as_of,
|
|
250
|
+
},
|
|
251
|
+
null,
|
|
252
|
+
1,
|
|
253
|
+
),
|
|
254
|
+
};
|
|
255
|
+
},
|
|
256
|
+
},
|
|
209
257
|
{
|
|
210
258
|
name: "area",
|
|
211
259
|
template: {
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
result,
|
|
16
16
|
summary,
|
|
17
17
|
} from "./common.mjs";
|
|
18
|
+
import { I5, axisOf, pairRow, pairLine } from "../i5.mjs";
|
|
18
19
|
|
|
19
20
|
const PlaceDetail = PlaceItem.extend({
|
|
20
21
|
...Envelope,
|
|
@@ -30,6 +31,21 @@ const PlaceDetail = PlaceItem.extend({
|
|
|
30
31
|
}),
|
|
31
32
|
),
|
|
32
33
|
review_due: z.string(),
|
|
34
|
+
axis: z
|
|
35
|
+
.looseObject({
|
|
36
|
+
route: z.string(),
|
|
37
|
+
s: z.number(),
|
|
38
|
+
mile: z.number(),
|
|
39
|
+
offM: z.number(),
|
|
40
|
+
side: z.string(),
|
|
41
|
+
ele: z.number(),
|
|
42
|
+
strip: z.string(),
|
|
43
|
+
})
|
|
44
|
+
.nullable()
|
|
45
|
+
.describe(
|
|
46
|
+
"Where the place sits on the I-5 axis: s meters from San Ysidro, Caltrans mile, meters off the road, side of northbound travel, road elevation, strip; null off I-5",
|
|
47
|
+
),
|
|
48
|
+
paired_stop: z.looseObject({}).nullable(),
|
|
33
49
|
});
|
|
34
50
|
|
|
35
51
|
export const getPlace = (ctx) => ({
|
|
@@ -37,7 +53,7 @@ export const getPlace = (ctx) => ({
|
|
|
37
53
|
title: "Get place details",
|
|
38
54
|
since: "0.1.0",
|
|
39
55
|
cache: true,
|
|
40
|
-
description: `The full record for one place you already know by id: every dog rule with its display text, the rules list, and each source with its URL, publisher, capture date and quote.
|
|
56
|
+
description: `The full record for one place you already know by id: every dog rule with its display text, the rules list, and each source with its URL, publisher, capture date and quote. A place on I-5 in California also carries its axis position (s meters from San Ysidro on the I-5 centerline, Caltrans mile, meters off the road, side of northbound travel, road elevation, strip) and, when it is the dog side of a paired stop, that pair: the exit and the people-stops near it (counted from OpenStreetMap, never named, not verified for restrooms).
|
|
41
57
|
|
|
42
58
|
Takes a place id, as returned in every search result. Example: id="carmel-beach".`,
|
|
43
59
|
inputSchema: z.strictObject({
|
|
@@ -56,6 +72,11 @@ Takes a place id, as returned in every search result. Example: id="carmel-beach"
|
|
|
56
72
|
const today = ctx.today();
|
|
57
73
|
const fresh = placeFreshness(p, today);
|
|
58
74
|
const rules = p.rule_records.map((r) => ruleWithFreshness(r, today));
|
|
75
|
+
const axis = axisOf(ctx.graph.routes[I5]);
|
|
76
|
+
const pair = axis
|
|
77
|
+
? (axis.paired ?? []).find((x) => x.dogStop.placeId === p.id)
|
|
78
|
+
: null;
|
|
79
|
+
const pairedStop = pair ? pairRow(pair, ctx.graph) : null;
|
|
59
80
|
const data = {
|
|
60
81
|
...ctx.citations.envelope(ctx.graph.as_of),
|
|
61
82
|
...summary(p, today),
|
|
@@ -70,6 +91,8 @@ Takes a place id, as returned in every search result. Example: id="carmel-beach"
|
|
|
70
91
|
sources: p.sources,
|
|
71
92
|
review_due: p.review_due,
|
|
72
93
|
record_license: p.record_license,
|
|
94
|
+
axis: p.axis ?? null,
|
|
95
|
+
paired_stop: pairedStop,
|
|
73
96
|
...(p.osm ? { attribution: OSM_ATTRIBUTION } : {}),
|
|
74
97
|
};
|
|
75
98
|
const ruleBy = Object.fromEntries(rules.map((r) => [r.kind, r]));
|
|
@@ -88,6 +111,20 @@ Takes a place id, as returned in every search result. Example: id="carmel-beach"
|
|
|
88
111
|
...(p.rules.length
|
|
89
112
|
? ["", "Rules:", ...p.rules.map((r) => `- ${r}`)]
|
|
90
113
|
: []),
|
|
114
|
+
...(p.axis
|
|
115
|
+
? [
|
|
116
|
+
"",
|
|
117
|
+
`On I-5 at mile ${p.axis.mile.toFixed(1)}, ${(p.axis.offM / 1609.344).toFixed(1)} mi off the freeway, ${p.axis.side === "both" ? "both directions" : p.axis.side === "right" ? "northbound side" : "southbound side"}, road at ${Math.round(p.axis.ele * 3.28084).toLocaleString("en-US")} ft (${p.axis.ele} m) elevation.`,
|
|
118
|
+
]
|
|
119
|
+
: []),
|
|
120
|
+
...(pairedStop
|
|
121
|
+
? [
|
|
122
|
+
"",
|
|
123
|
+
"Paired stop (the dog side of an exit pairing):",
|
|
124
|
+
pairLine(pairedStop),
|
|
125
|
+
"Exit numbers and people-stop counts are OpenStreetMap data (ODbL); restrooms at a people-stop are not verified.",
|
|
126
|
+
]
|
|
127
|
+
: []),
|
|
91
128
|
"",
|
|
92
129
|
"Sources:",
|
|
93
130
|
...p.sources.flatMap((s) => [
|