dogpolicies-mcp 0.3.0 → 0.4.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 CHANGED
@@ -10,6 +10,75 @@ 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.4.0 - 2026-11-07
14
+
15
+ Answers, not errors. A question the data cannot answer now comes back as a
16
+ normal answer that says so and helps, never as a dead end, and `isError` is
17
+ reserved for the server itself failing. Directories that score a server by
18
+ its `isError` rate (Claude's does) had been counting "Van Nuys is not a town
19
+ we cover" against us; what they count now is what a person would call an
20
+ error.
21
+
22
+ Changed
23
+
24
+ - `not_found`, `invalid`, `unavailable` and `offline` results are no longer
25
+ `isError`. They are answers with `outcome` (`no_match`, `bad_input`,
26
+ `partial` or `unavailable`), `code`, `message`, and whichever of
27
+ `did_you_mean` (close matches: towns, places, slugs, brands), `nearest` (the
28
+ nearest records anyway, with distance), `missing` and `next` (what to call)
29
+ apply. Every such answer still satisfies the tool's output schema: list
30
+ fields are empty, counts are zero, and a field with nothing honest to hold
31
+ is `null` (`near.center`, `get_rule.rule` and `.place`,
32
+ `i5_conditions.fetched_at`, `get_place.freshness` in a no-match answer).
33
+ A client that branched on `isError` for these codes should read `outcome`.
34
+ `isError` remains for `internal` and `rate_limited`.
35
+ - `dogpolicies_near` widens its radius on its own (30, 60, then 100 miles,
36
+ reported as `radius_widened_from`) when nothing sits inside the one asked
37
+ for, and when the data has nothing within 100 miles it lists the five
38
+ nearest records and the nearest towns with records.
39
+ - `dogpolicies_get_place` and `dogpolicies_compare_places` resolve a near
40
+ miss (a misspelled id, a name a word off) to the one clear match, labeled
41
+ `resolved_from`; `compare_places` compares what it found and lists the
42
+ rest under `missing` (`outcome: partial`).
43
+ - `dogpolicies_get_rule` with a rule id whose place exists but has no such
44
+ rule answers with that place and its recorded rule ids.
45
+ - `dogpolicies_browse_answers` with an unknown slug answers with the closest
46
+ slugs and the whole list; `dogpolicies_get_brand_policy` with an unknown
47
+ brand lists the covered brands nearest in spelling and how to check that
48
+ chain's hotels one by one.
49
+ - `dogpolicies_report_correction` with an unknown place answers
50
+ `bad_input` with close matches and files nothing; an unreachable inbox is
51
+ `unavailable` with the form's address.
52
+ - `dogpolicies_i5_conditions` reads the conditions document in-process on
53
+ the hosted server (it had been answering `offline` there since 0.3.0), marks
54
+ a reading older than two hours `stale`, and when no document can be read
55
+ answers `unavailable` with the live page's address. A point too far from
56
+ I-5 (also in `dogpolicies_i5_corridor`) answers `bad_input` with
57
+ `nearest_i5`: the nearest mile and how far it is.
58
+ - Numeric inputs accept numbers written as strings; `dogs` up to 10, `nights`
59
+ up to 90, `dog_weight_lb` up to 300, `max_total_fee` up to 10,000.
60
+ - The server instructions tell the model there are no dead ends and how to
61
+ use `outcome`, `did_you_mean`, `nearest` and `next`.
62
+
63
+ Fixed
64
+
65
+ - On I-5, `dogpolicies_route_stops`, `dogpolicies_i5_corridor` and the
66
+ drive leg of `dogpolicies_plan_trip` left out every park, hotel, campground
67
+ and patio on the far bank of the freeway: 195 of 422 stops northbound, 199
68
+ southbound (since 0.3.0). The geometric side of the road is now wording
69
+ only; a stop is one-way only when Caltrans lists it for one direction (a
70
+ rest area).
71
+ - The site's in-process server (`npm run preview`, stdio) now carries the
72
+ I-5 axis like the hosted Worker, so the three servers answer alike.
73
+
74
+ Added
75
+
76
+ - Output fields on every tool: `outcome`, `code`, `message`, `did_you_mean`,
77
+ `nearest`, `next` (all optional); `near.radius_widened_from` and `.nearest`;
78
+ `get_place.resolved_from`; `compare_places.missing`;
79
+ `i5_conditions.stale` and `.nearest_i5`; `i5_corridor.nearest_i5`;
80
+ `report_correction.form_url`.
81
+
13
82
  ## 0.3.0 - 2026-11-04
14
83
 
15
84
  The I-5 axis: every I-5 stop in California carries its position on the I-5
package/README.md CHANGED
@@ -144,25 +144,25 @@ The `demo` output is the exact text an assistant receives:
144
144
 
145
145
  ## Tools
146
146
 
147
- | Tool | What it does |
148
- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
149
- | `dogpolicies_search_places` | Search by name, type (beach, park, trail, lodging, campground, cabins, restaurant), county, state, region or a point and radius; filter to dogs allowed or off-leash. |
150
- | `dogpolicies_near` | Everything dog-related near a town, county or point, grouped by kind and sorted by distance. Takes a town name; no coordinates needed. |
151
- | `dogpolicies_get_place` | Full record for one place: every fact, its source with URL, date and quote, rule ids, and what the source does not state. |
152
- | `dogpolicies_compare_places` | Two to six places side by side: dogs allowed, leash, fee, weight limit, pets per room, freshness, who confirmed. |
153
- | `dogpolicies_plan_trip` | A stay in a town with this dog: stays that fit (fee for the whole stay worked out), beaches, parks, trails and patios nearby. |
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
- | `dogpolicies_get_brand_policy` | A chain's published pet policy, its listed exceptions and property counts. |
156
- | `dogpolicies_browse_answers` | Ready-made answers to common questions ("Which California state parks allow dogs?"). |
147
+ | Tool | What it does |
148
+ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
149
+ | `dogpolicies_search_places` | Search by name, type (beach, park, trail, lodging, campground, cabins, restaurant), county, state, region or a point and radius; filter to dogs allowed or off-leash. |
150
+ | `dogpolicies_near` | Everything dog-related near a town, county or point, grouped by kind and sorted by distance. Takes a town name; no coordinates needed. |
151
+ | `dogpolicies_get_place` | Full record for one place: every fact, its source with URL, date and quote, rule ids, and what the source does not state. |
152
+ | `dogpolicies_compare_places` | Two to six places side by side: dogs allowed, leash, fee, weight limit, pets per room, freshness, who confirmed. |
153
+ | `dogpolicies_plan_trip` | A stay in a town with this dog: stays that fit (fee for the whole stay worked out), beaches, parks, trails and patios nearby. |
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
+ | `dogpolicies_get_brand_policy` | A chain's published pet policy, its listed exceptions and property counts. |
156
+ | `dogpolicies_browse_answers` | Ready-made answers to common questions ("Which California state parks allow dogs?"). |
157
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. |
160
- | `dogpolicies_get_rule` | One rule by its stable id, with source, quote, confidence, verified date and freshness. |
161
- | `dogpolicies_changes_since` | Verification events and rule changes since a date, newest first. |
162
- | `dogpolicies_changes_near` | The same, limited to a radius around a town or point. |
163
- | `dogpolicies_report_correction` | Files a correction for a person to verify. Nothing is published automatically. The only tool that writes. |
164
-
165
- Every tool returns readable markdown by default and structured JSON (`response_format: "json"`), with an output schema. Every record carries `confidence` (stated, inferred_from_agency, inherited_brand), `freshness` (fresh, due, stale, unreadable, computed for today), `verified_at`, `url` and `source_urls`. Errors set `isError` with a code: `not_found`, `invalid`, `rate_limited`, `unavailable`, `offline`. The full reference, generated from the code, is [docs/tools.md](docs/tools.md).
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. |
160
+ | `dogpolicies_get_rule` | One rule by its stable id, with source, quote, confidence, verified date and freshness. |
161
+ | `dogpolicies_changes_since` | Verification events and rule changes since a date, newest first. |
162
+ | `dogpolicies_changes_near` | The same, limited to a radius around a town or point. |
163
+ | `dogpolicies_report_correction` | Files a correction for a person to verify. Nothing is published automatically. The only tool that writes. |
164
+
165
+ Every tool returns readable markdown by default and structured JSON (`response_format: "json"`), with an output schema. Every record carries `confidence` (stated, inferred_from_agency, inherited_brand), `freshness` (fresh, due, stale, unreadable, computed for today), `verified_at`, `url` and `source_urls`. There are no dead ends: when nothing matches, the result is a normal answer with `outcome` (`no_match`, `bad_input`, `partial`, `unavailable`), `code`, `message`, and whichever of `did_you_mean` (close matches), `nearest` (the nearest records anyway), `missing` and `next` (what to call) apply. `isError` is set only when the server itself failed (`internal`) or refused a write (`rate_limited`). The full reference, generated from the code, is [docs/tools.md](docs/tools.md).
166
166
 
167
167
  ### Resources and prompts
168
168
 
Binary file
@@ -79,7 +79,10 @@ The core wraps each handler: the SDK validates input against the zod schema
79
79
  before the handler runs; a cached result is served when the data version and
80
80
  arguments match; a thrown `ToolError` becomes `{ isError, code }`; any other
81
81
  exception becomes `internal` with no stack in the result; the call is timed
82
- to the debug log. Resources (`{ uri | template, read }`) and prompts
82
+ to the debug log. A tool that finds nothing does not throw: it returns an
83
+ `answer()` (`core/errors.mjs`) whose `outcome` says what happened and whose
84
+ shape satisfies the tool's output schema, so the SDK's output validation
85
+ still runs on it and no directory counts it as an error. Resources (`{ uri | template, read }`) and prompts
83
86
  (`{ argsSchema, build }`) are registered the same way, with cache hints on
84
87
  the list methods and resource reads so 2026-07-28 clients can cache them.
85
88
 
package/docs/tools.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Tool reference
2
2
 
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.
3
+ dogpolicies-mcp 0.4.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
 
@@ -8,7 +8,7 @@ dogpolicies-mcp 0.3.0, generated by `node scripts/docs.mjs` from the live defini
8
8
 
9
9
  Search parks, beaches, trails, hotels, campgrounds and cabin resorts in California and Nevada by name, location and dog rules.
10
10
 
11
- Returns one page of places with a one-line answer ("Yes, on a leash no longer than 6 feet."), status (yes, yes_restricted, no, varies), verification date and page URL. Each result includes the place id.
11
+ Returns one page of places with a one-line answer ("Yes, on a leash no longer than 6 feet."), status (yes, yes_restricted, no, varies), verification date and page URL. Each result includes the place id. When nothing matches, the answer (outcome no_match) carries close matches (did_you_mean: places and towns) and what to call next; a town name in query points to dogpolicies_near.
12
12
 
13
13
  Examples:
14
14
  - "Off-leash beaches near San Diego" -> type="beach", off_leash=true, near={lat:32.72, lon:-117.16}
@@ -37,7 +37,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
37
37
  | `offset` | integer (min 0, max 9007199254740991, default `0`) | Results to skip, for pagination |
38
38
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
39
39
 
40
- Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `total`, `count`, `offset`, `has_more`, `places` (more may be added; none removed).
40
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `total`, `count`, `offset`, `has_more`, `places` (more may be added; none removed).
41
41
 
42
42
  ## `dogpolicies_near`
43
43
 
@@ -45,18 +45,19 @@ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `total
45
45
 
46
46
  Anything for dogs around a town, county or point: everything dog-related nearby, grouped by kind: beaches, parks, trails, hotels, campgrounds, cabins, places to eat and rest areas, each sorted by distance, with the dog rule and citation for each. Answers "what can I do with my dog there?" for a named place.
47
47
 
48
- Takes a town or county name (no coordinates needed) or a point.
48
+ Takes a town, county, area, region or neighborhood name (no coordinates needed) or a point. Small spelling slips are corrected and labeled. When nothing is inside the radius, the search widens on its own (to 30, 60, then 100 miles) and says so; when the data has nothing near at all, the answer lists the nearest records anyway, so there is always something to offer. A name the data does not know comes back with close matches (did_you_mean) and what to call next, not an error.
49
49
 
50
50
  Examples:
51
51
  - "What can my dog do in Carmel?" -> place="Carmel"
52
52
  - "Dog beaches and parks around South Lake Tahoe" -> place="South Lake Tahoe", types=["beach","park"]
53
+ - "Anything dog-friendly in Van Nuys?" -> place="Van Nuys"
53
54
  - "Anything dog-friendly within 5 miles of here" -> near={lat:36.6, lon:-121.9}, radius_miles=5
54
55
 
55
56
  Annotations: read-only true, destructive false, idempotent true, open-world false.
56
57
 
57
58
  | Input | Type | Meaning |
58
59
  |---|---|---|
59
- | `place` | string (min length 2, max length 80) | A city, county or area in California or Nevada, e.g. "Monterey", "South Lake Tahoe", "Washoe County, NV", "Las Vegas", "East Bay" or "Lake Tahoe" |
60
+ | `place` | string (min length 2, max length 80) | A city, county, area, region or neighborhood in California or Nevada, e.g. "Monterey", "South Lake Tahoe", "Washoe County, NV", "Las Vegas", "East Bay", "Lake Tahoe", "Central Valley" or "Van Nuys". Small spelling slips are corrected and the answer says so. |
60
61
  | `near` | object | A point instead of a town; give one of place or near |
61
62
  | `radius_miles` | number (min 1, max 100, default `15`) | Search radius in miles around the town or point (an area is its own boundary; the radius is ignored) |
62
63
  | `types` | array of `beach`, `park`, `trail`, `lodging`, `campground`, `cabins`, `restaurant`, `rest_area`, `stop` | Kinds to include; all by default |
@@ -64,7 +65,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
64
65
  | `per_type` | integer (min 1, max 20, default `5`) | Nearest results to show per kind |
65
66
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
66
67
 
67
- Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `center`, `label`, `radius_miles`, `total`, `groups` (more may be added; none removed).
68
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `center`, `label`, `radius_miles`, `radius_widened_from`, `total`, `groups` (more may be added; none removed).
68
69
 
69
70
  ## `dogpolicies_get_place`
70
71
 
@@ -72,7 +73,7 @@ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `cente
72
73
 
73
74
  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
75
 
75
- Takes a place id, as returned in every search result. Example: id="carmel-beach".
76
+ Takes a place id, as returned in every search result; a place's exact name works too, and a near miss resolves to the one clear match (labeled resolved_from). An id nothing matches comes back as an answer with close matches (did_you_mean), not an error. Example: id="carmel-beach".
76
77
 
77
78
  Annotations: read-only true, destructive false, idempotent true, open-world false.
78
79
 
@@ -81,7 +82,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
81
82
  | `id` (required) | string (min length 2, max length 120) | Place id, e.g. "fort-funston" |
82
83
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
83
84
 
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
+ 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`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `resolved_from`, `facts`, `rule_records`, `not_stated`, `rules`, `sources`, `review_due`, `axis`, `paired_stop` (more may be added; none removed).
85
86
 
86
87
  ## `dogpolicies_compare_places`
87
88
 
@@ -89,7 +90,7 @@ Output fields: `id`, `uid`, `name`, `type`, `status`, `answer`, `citation`, `con
89
90
 
90
91
  Which one is better for a dog? Compare two to six places on the facts that decide a dog trip: dogs allowed, leash rule, where dogs may go, pet fee, weight limit, pets per room, restrictions, plus confidence, freshness and who confirmed each record. One row per fact, one column per place, every place with its citation.
91
92
 
92
- Answers "which one?" between candidates; ids come from any search result. Example: ids=["carmel-beach","asilomar-state-beach"].
93
+ Answers "which one?" between candidates; ids come from any search result (an exact name or a near miss resolves to the one clear match). An id nothing matches is listed under missing with close matches, and the rest are still compared (outcome partial); with fewer than two found, the answer is no_match with suggestions. Example: ids=["carmel-beach","asilomar-state-beach"].
93
94
 
94
95
  Annotations: read-only true, destructive false, idempotent true, open-world false.
95
96
 
@@ -98,7 +99,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
98
99
  | `ids` (required) | array of string | Two to six place ids from search results |
99
100
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
100
101
 
101
- Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `places`, `rows` (more may be added; none removed).
102
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `places`, `rows`, `missing` (more may be added; none removed).
102
103
 
103
104
  ## `dogpolicies_plan_trip`
104
105
 
@@ -117,19 +118,19 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
117
118
 
118
119
  | Input | Type | Meaning |
119
120
  |---|---|---|
120
- | `place` | string (min length 2, max length 80) | A city, county or area in California or Nevada, e.g. "Monterey", "South Lake Tahoe", "Washoe County, NV", "Las Vegas", "East Bay" or "Lake Tahoe" |
121
+ | `place` | string (min length 2, max length 80) | A city, county, area, region or neighborhood in California or Nevada, e.g. "Monterey", "South Lake Tahoe", "Washoe County, NV", "Las Vegas", "East Bay", "Lake Tahoe", "Central Valley" or "Van Nuys". Small spelling slips are corrected and the answer says so. |
121
122
  | `near` | object | A point instead of a town; give one of place or near |
122
123
  | `radius_miles` | number (min 1, max 100, default `15`) | Search radius in miles around the town or point (an area is its own boundary; the radius is ignored) |
123
- | `dog_weight_lb` | number (min 1, max 250) | The dog's weight in pounds |
124
- | `dogs` | integer (min 1, max 4, default `1`) | Number of dogs |
125
- | `nights` | integer (min 1, max 30, default `1`) | Nights of the stay |
126
- | `max_total_fee` | number (min 0, max 5000) | Most the guest will pay in pet fees for the whole stay, USD |
124
+ | `dog_weight_lb` | number (min 1, max 300) | The dog's weight in pounds |
125
+ | `dogs` | integer (min 1, max 10, default `1`) | Number of dogs |
126
+ | `nights` | integer (min 1, max 90, default `1`) | Nights of the stay |
127
+ | `max_total_fee` | number (min 0, max 10000) | Most the guest will pay in pet fees for the whole stay, USD |
127
128
  | `stay_types` | array of `lodging`, `campground`, `cabins` (default `["lodging","campground","cabins"]`) | Kinds of stay to consider |
128
129
  | `include_possible` | boolean (default `true`) | Include stays that need a call to confirm |
129
130
  | `per_section` | integer (min 1, max 15, default `5`) | Results per section |
130
131
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
131
132
 
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
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `label`, `radius_miles`, `asked`, `stays`, `stay_counts`, `outings`, `i5` (more may be added; none removed).
133
134
 
134
135
  ## `dogpolicies_find_hotels`
135
136
 
@@ -153,10 +154,10 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
153
154
  |---|---|---|
154
155
  | `query` | string (min length 2, max length 100) | Words in the hotel name, city or brand |
155
156
  | `brand` | `best-western`, `extended-stay-america`, `kimpton`, `la-quinta`, `motel-6`, `red-roof` | Only this hotel brand |
156
- | `dog_weight_lb` | number (min 1, max 250) | The dog's weight in pounds |
157
- | `dogs` | integer (min 1, max 4, default `1`) | Number of dogs |
158
- | `nights` | integer (min 1, max 30, default `1`) | Nights of the stay |
159
- | `max_total_fee` | number (min 0, max 5000) | Most the guest will pay in pet fees for the whole stay, USD |
157
+ | `dog_weight_lb` | number (min 1, max 300) | The dog's weight in pounds |
158
+ | `dogs` | integer (min 1, max 10, default `1`) | Number of dogs |
159
+ | `nights` | integer (min 1, max 90, default `1`) | Nights of the stay |
160
+ | `max_total_fee` | number (min 0, max 10000) | Most the guest will pay in pet fees for the whole stay, USD |
160
161
  | `include_possible` | boolean (default `true`) | Include hotels that need a call to confirm |
161
162
  | `state` | `CA`, `NV` | "CA" or "NV". Also tells apart counties with the same name, such as Humboldt. |
162
163
  | `county` | string (min length 2, max length 40) | County name without "County", in California or Nevada, e.g. "Monterey" or "Washoe" |
@@ -167,7 +168,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
167
168
  | `offset` | integer (min 0, max 9007199254740991, default `0`) | Results to skip, for pagination |
168
169
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
169
170
 
170
- Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `total`, `count`, `offset`, `has_more`, `hotels`, `counts` (more may be added; none removed).
171
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `total`, `count`, `offset`, `has_more`, `hotels`, `counts` (more may be added; none removed).
171
172
 
172
173
  ## `dogpolicies_get_brand_policy`
173
174
 
@@ -184,7 +185,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
184
185
  | `brand` (required) | string (min length 2, max length 60) | Brand id or name |
185
186
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
186
187
 
187
- Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `id`, `name`, `answer`, `facts`, `not_stated`, `verified_at`, `url`, `source_urls` (more may be added; none removed).
188
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `resolved_from`, `id`, `name`, `answer`, `facts`, `not_stated`, `verified_at`, `url`, `source_urls` (more may be added; none removed).
188
189
 
189
190
  ## `dogpolicies_browse_answers`
190
191
 
@@ -203,7 +204,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
203
204
  | `offset` | integer (min 0, max 9007199254740991, default `0`) | Results to skip, for pagination |
204
205
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
205
206
 
206
- Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `total`, `questions`, `places` (more may be added; none removed).
207
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `total`, `questions`, `places` (more may be added; none removed).
207
208
 
208
209
  ## `dogpolicies_route_stops`
209
210
 
@@ -240,15 +241,15 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
240
241
  | `family` | boolean (default `false`) | Only stops whose official source states restrooms and a pet area or dog park (I-5 in California) |
241
242
  | `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) |
242
243
  | `dog_friendly_only` | boolean (default `true`) | Leave out stops where dogs are not allowed |
243
- | `dog_weight_lb` | number (min 1, max 250) | The dog's weight in pounds |
244
- | `dogs` | integer (min 1, max 4, default `1`) | Number of dogs |
245
- | `nights` | integer (min 1, max 30, default `1`) | Nights of the stay |
246
- | `max_total_fee` | number (min 0, max 5000) | Most the guest will pay in pet fees for the whole stay, USD |
244
+ | `dog_weight_lb` | number (min 1, max 300) | The dog's weight in pounds |
245
+ | `dogs` | integer (min 1, max 10, default `1`) | Number of dogs |
246
+ | `nights` | integer (min 1, max 90, default `1`) | Nights of the stay |
247
+ | `max_total_fee` | number (min 0, max 10000) | Most the guest will pay in pet fees for the whole stay, USD |
247
248
  | `limit` | integer (min 1, max 50, default `10`) | Maximum results to return |
248
249
  | `offset` | integer (min 0, max 9007199254740991, default `0`) | Results to skip, for pagination |
249
250
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
250
251
 
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
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `total`, `count`, `offset`, `has_more`, `stops`, `route`, `guide`, `start`, `paired_stops` (more may be added; none removed).
252
253
 
253
254
  ## `dogpolicies_i5_corridor`
254
255
 
@@ -282,7 +283,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
282
283
  | `offset` | integer (min 0, max 9007199254740991, default `0`) | Stops to skip |
283
284
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
284
285
 
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
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `nearest_i5`, `axis_version`, `strips`, `window`, `total`, `stops`, `paired_stops` (more may be added; none removed).
286
287
 
287
288
  ## `dogpolicies_i5_conditions`
288
289
 
@@ -290,7 +291,7 @@ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `axis_
290
291
 
291
292
  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
 
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
+ 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. When the document cannot be read (no network, feeds down), the answer has outcome unavailable and the live page's address; a document older than two hours is marked stale.
294
295
 
295
296
  Examples:
296
297
  - "Is there a closure or chains on the Grapevine right now?" -> from_mile=170, to_mile=222
@@ -307,7 +308,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
307
308
  | `ahead_miles` | number (min 1, max 800, default `50`) | Window in miles from near |
308
309
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
309
310
 
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).
311
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `fetched_at`, `stale`, `notice`, `window`, `chains_in_effect`, `closures`, `weather`, `signs`, `chain_controls`, `source`, `nearest_i5` (more may be added; none removed).
311
312
 
312
313
  ## `dogpolicies_get_rule`
313
314
 
@@ -322,7 +323,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
322
323
  | `id` (required) | string (min length 6, max length 80) | Rule id, e.g. "rul_t6cqwy0x4ce2dmpq_fee" |
323
324
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
324
325
 
325
- Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `rule`, `place` (more may be added; none removed).
326
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `rule`, `place` (more may be added; none removed).
326
327
 
327
328
  ## `dogpolicies_changes_since`
328
329
 
@@ -354,7 +355,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
354
355
 
355
356
  | Input | Type | Meaning |
356
357
  |---|---|---|
357
- | `place` | string (min length 2, max length 80) | A city, county or area in California or Nevada, e.g. "Monterey", "South Lake Tahoe", "Washoe County, NV", "Las Vegas", "East Bay" or "Lake Tahoe" |
358
+ | `place` | string (min length 2, max length 80) | A city, county, area, region or neighborhood in California or Nevada, e.g. "Monterey", "South Lake Tahoe", "Washoe County, NV", "Las Vegas", "East Bay", "Lake Tahoe", "Central Valley" or "Van Nuys". Small spelling slips are corrected and the answer says so. |
358
359
  | `near` | object | A point instead of a town; give one of place or near |
359
360
  | `radius_miles` | number (min 1, max 100, default `15`) | Search radius in miles around the town or point (an area is its own boundary; the radius is ignored) |
360
361
  | `since` (required) | string | Date, YYYY-MM-DD |
@@ -363,7 +364,7 @@ Annotations: read-only true, destructive false, idempotent true, open-world fals
363
364
  | `offset` | integer (min 0, max 9007199254740991, default `0`) | Results to skip, for pagination |
364
365
  | `response_format` | `markdown`, `json` (default `"markdown"`) | 'markdown' for readable text, 'json' for structured data |
365
366
 
366
- Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `label`, `radius_miles`, `total`, `count`, `has_more`, `events` (more may be added; none removed).
367
+ Output fields: `as_of`, `license`, `attribution_text`, `attribution_url`, `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `label`, `radius_miles`, `total`, `count`, `has_more`, `events` (more may be added; none removed).
367
368
 
368
369
  ## `dogpolicies_report_correction`
369
370
 
@@ -380,7 +381,7 @@ Annotations: read-only false, destructive false, idempotent false, open-world tr
380
381
  | `source_url` | string (max length 500) | The official page that shows the current rule, if the user has it |
381
382
  | `contact` | string (max length 200) | How to reach the reporter, only if they offer it |
382
383
 
383
- Output fields: `report_id`, `place_id`, `status`, `url` (more may be added; none removed).
384
+ Output fields: `outcome`, `code`, `message`, `did_you_mean`, `nearest`, `next`, `report_id`, `place_id`, `status`, `url`, `form_url` (more may be added; none removed).
384
385
 
385
386
  # Resources
386
387
 
@@ -21,8 +21,10 @@ treated elsewhere, so nothing breaks in a 0.x minor either).
21
21
  - Output fields named in each tool's `outputSchema`, and the shape of the
22
22
  envelope (`as_of`, `license`, `attribution_text`, `attribution_url`,
23
23
  `total`, `count`, `offset`, `has_more`, `next_offset`).
24
- - Error codes: `not_found`, `invalid`, `rate_limited`, `unavailable`,
25
- `offline`, `internal`.
24
+ - Outcomes and codes: an answer's `outcome` (`ok`, `partial`, `no_match`,
25
+ `bad_input`, `unavailable`) and `code` (`not_found`, `invalid`,
26
+ `unavailable`); the error codes `internal` and `rate_limited`, the only
27
+ ones that set `isError` (since 0.4.0).
26
28
  - Resource URIs and prompt names.
27
29
  - The first line of every markdown result being a citation and the last the
28
30
  attribution line.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dogpolicies-mcp",
3
- "version": "0.3.0",
3
+ "version": "0.4.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.3.0",
11
+ "version": "0.4.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.3.0",
17
+ "version": "0.4.0",
18
18
  "runtimeHint": "npx",
19
19
  "transport": {
20
20
  "type": "stdio"
@@ -1,7 +1,70 @@
1
- // The error model every tool shares. A tool never throws at a client: it
2
- // returns a result with `isError`, a stable code the client can branch on,
3
- // and a message a person can read. Unknown exceptions become `internal`
4
- // without leaking a stack trace.
1
+ // The error model every tool shares. A tool never throws at a client. Two
2
+ // kinds of result leave a tool:
3
+ //
4
+ // an answer the server did its work; `outcome` says what it found. A
5
+ // place that is not in the data, an argument that cannot be
6
+ // used as given, a live feed that could not be read: each is
7
+ // an answer with suggestions (did_you_mean, nearest, next),
8
+ // never a dead end and never `isError`.
9
+ // an error the server itself failed (`internal`) or refused a write
10
+ // (`rate_limited`): `isError` with a stable code.
11
+ //
12
+ // Directories count every `isError` result against a server, whatever the
13
+ // code, so the line between the two is drawn at "did the server break".
14
+ // Unknown exceptions become `internal` without leaking a stack trace.
15
+
16
+ /** What a normal answer found. Absent or "ok" is the usual case. */
17
+ export const OUTCOMES = Object.freeze({
18
+ ok: "ok",
19
+ /** Some of what was asked for was found; `missing` names the rest. */
20
+ partial: "partial",
21
+ /** Nothing in the data matches; see did_you_mean, nearest and next. */
22
+ no_match: "no_match",
23
+ /** The arguments cannot be used as given; `next` says what would work. */
24
+ bad_input: "bad_input",
25
+ /** A live source could not be read; the data is not the problem. */
26
+ unavailable: "unavailable",
27
+ });
28
+
29
+ /**
30
+ * An answer that is not an error. `shape` holds whatever the tool's output
31
+ * contract requires (empty lists, zero counts, nulls), so the result passes
32
+ * the output schema; the outcome fields say what happened; `text` is the
33
+ * markdown a person reads (the message when none is given).
34
+ */
35
+ export function answer({
36
+ outcome,
37
+ code = null,
38
+ message,
39
+ shape = {},
40
+ did_you_mean,
41
+ nearest,
42
+ missing,
43
+ next,
44
+ format = "markdown",
45
+ text,
46
+ }) {
47
+ const data = {
48
+ ...shape,
49
+ outcome,
50
+ ...(code ? { code } : {}),
51
+ message,
52
+ ...(did_you_mean ? { did_you_mean } : {}),
53
+ ...(nearest ? { nearest } : {}),
54
+ ...(missing ? { missing } : {}),
55
+ ...(next?.length ? { next } : {}),
56
+ };
57
+ return {
58
+ content: [
59
+ {
60
+ type: "text",
61
+ text:
62
+ format === "json" ? JSON.stringify(data, null, 2) : (text ?? message),
63
+ },
64
+ ],
65
+ structuredContent: data,
66
+ };
67
+ }
5
68
 
6
69
  /** Stable error codes. Add codes; never rename one. */
7
70
  export const CODES = Object.freeze({
@@ -18,9 +18,13 @@ export function calibrationOf(axis) {
18
18
  const ss = axis.calibration.map((r) => r[1]);
19
19
  const n = miles.length;
20
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]);
21
+ if (x <= xs[0])
22
+ return ys[0] + ((x - xs[0]) * (ys[1] - ys[0])) / (xs[1] - xs[0]);
22
23
  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
+ return (
25
+ ys[n - 1] +
26
+ ((x - xs[n - 1]) * (ys[n - 1] - ys[n - 2])) / (xs[n - 1] - xs[n - 2])
27
+ );
24
28
  let lo = 0;
25
29
  let hi = n - 1;
26
30
  while (hi - lo > 1) {
@@ -89,7 +93,11 @@ export function hoursOf(p) {
89
93
  const row = (p.rows ?? []).find((r) => r.key === "hours");
90
94
  if (!row) return null;
91
95
  const src = (p.sources ?? [])[row.source - 1];
92
- return { text: row.value, source_url: src?.url ?? null, checked: src?.checked ?? null };
96
+ return {
97
+ text: row.value,
98
+ source_url: src?.url ?? null,
99
+ checked: src?.checked ?? null,
100
+ };
93
101
  }
94
102
 
95
103
  /**
@@ -103,7 +111,8 @@ export function axisFields(stop, { startS = null, ahead = true } = {}) {
103
111
  s_m: stop.s_m ?? null,
104
112
  miles_ahead:
105
113
  stop.s_m != null && startS != null
106
- ? Math.round((((ahead ? 1 : -1) * (stop.s_m - startS)) / MILE_M) * 10) / 10
114
+ ? Math.round((((ahead ? 1 : -1) * (stop.s_m - startS)) / MILE_M) * 10) /
115
+ 10
107
116
  : null,
108
117
  side: stop.axis_side ?? null,
109
118
  off_miles: stop.off_miles ?? null,
@@ -119,11 +128,17 @@ export function axisFields(stop, { startS = null, ahead = true } = {}) {
119
128
  return out;
120
129
  }
121
130
 
122
- /** True when the stop serves travel in this direction (ahead = northbound). */
131
+ /**
132
+ * True when the stop serves travel in this direction (ahead = northbound).
133
+ * Only `side` makes a stop one-way: a rest area Caltrans lists for one
134
+ * direction ("ahead" northbound, "back" southbound). Every other place, and a
135
+ * rest area with no direction, serves both: a park or a hotel across the
136
+ * freeway is an exit and an overpass away. `axis_side` is the bank of the
137
+ * road the place sits on (src/lib/axis.mjs), kept for the answer's wording,
138
+ * never a filter: reading it as one hid half the I-5 stops in each direction.
139
+ */
123
140
  export const servesDirection = (stop, ahead) =>
124
- !stop.axis_side ||
125
- stop.axis_side === "both" ||
126
- stop.axis_side === (ahead ? "right" : "left");
141
+ stop.side == null || stop.side === (ahead ? "ahead" : "back");
127
142
 
128
143
  /**
129
144
  * The window of stops from a start s in a direction: ahead means increasing
@@ -156,12 +171,20 @@ export function pairedIn(axis, lo, hi) {
156
171
  /** The sentence for a pair's people side: counts and kinds, never a name. */
157
172
  export function peopleStopsText(c) {
158
173
  const parts = [];
159
- if (c.cafe) parts.push(c.cafe === 1 ? "a coffee shop" : `${c.cafe} coffee shops`);
174
+ if (c.cafe)
175
+ parts.push(c.cafe === 1 ? "a coffee shop" : `${c.cafe} coffee shops`);
160
176
  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`);
177
+ parts.push(
178
+ c.fast_food === 1
179
+ ? "a fast-food place"
180
+ : `${c.fast_food} fast-food places`,
181
+ );
182
+ if (c.fuel)
183
+ parts.push(c.fuel === 1 ? "a gas station" : `${c.fuel} gas stations`);
163
184
  const list =
164
- parts.length > 1 ? `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}` : (parts[0] ?? "nothing");
185
+ parts.length > 1
186
+ ? `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`
187
+ : (parts[0] ?? "nothing");
165
188
  return `${list} within half a mile of the exit (locations from OpenStreetMap; restrooms not verified)`;
166
189
  }
167
190
 
@@ -170,7 +193,11 @@ export function pairRow(pair, graph) {
170
193
  const p = graph.placeById.get(pair.dogStop.placeId);
171
194
  return {
172
195
  exit: pair.exit,
173
- people_stops: { ...pair.peopleStops, restrooms: "unverified", source: "OpenStreetMap" },
196
+ people_stops: {
197
+ ...pair.peopleStops,
198
+ restrooms: "unverified",
199
+ source: "OpenStreetMap",
200
+ },
174
201
  dog_stop: {
175
202
  ...pair.dogStop,
176
203
  url: p?.url ?? null,
@@ -183,7 +210,11 @@ export function pairRow(pair, graph) {
183
210
  export function pairLine(row) {
184
211
  const d = row.dog_stop;
185
212
  const leash =
186
- d.leash === "required" ? ", on leash" : d.leash?.startsWith("off_leash") ? ", off leash" : "";
213
+ d.leash === "required"
214
+ ? ", on leash"
215
+ : d.leash?.startsWith("off_leash")
216
+ ? ", off leash"
217
+ : "";
187
218
  return [
188
219
  `- 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
220
  ` 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}`,