dogpolicies-mcp 0.3.0 → 0.4.1
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 +103 -0
- package/README.md +18 -18
- package/data/snapshot.json.gz +0 -0
- package/docs/architecture.md +4 -1
- package/docs/tools.md +36 -35
- package/docs/versioning.md +4 -2
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/core/errors.mjs +67 -4
- package/src/dogpolicies/i5.mjs +45 -14
- package/src/dogpolicies/resources.mjs +13 -5
- package/src/dogpolicies/server.mjs +15 -4
- package/src/dogpolicies/tools/browse-answers.mjs +62 -6
- package/src/dogpolicies/tools/changes-near.mjs +17 -3
- package/src/dogpolicies/tools/common.mjs +814 -28
- package/src/dogpolicies/tools/compare-places.mjs +85 -13
- package/src/dogpolicies/tools/get-brand-policy.mjs +102 -7
- package/src/dogpolicies/tools/get-place.mjs +91 -8
- package/src/dogpolicies/tools/get-rule.mjs +64 -11
- package/src/dogpolicies/tools/i5-conditions.mjs +143 -54
- package/src/dogpolicies/tools/i5-corridor.mjs +71 -7
- package/src/dogpolicies/tools/near.mjs +116 -15
- package/src/dogpolicies/tools/plan-trip.mjs +58 -4
- package/src/dogpolicies/tools/report-correction.mjs +76 -19
- package/src/dogpolicies/tools/scope.mjs +77 -27
- package/src/dogpolicies/tools/search-places.mjs +54 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,109 @@ 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.1 - 2026-11-08
|
|
14
|
+
|
|
15
|
+
The first roadmap release (`docs/ROADMAP.md` in the data repository: R-01,
|
|
16
|
+
R-02, R-03). The misses log and the directory's numbers said where the first
|
|
17
|
+
week leaked; this closes those leaks.
|
|
18
|
+
|
|
19
|
+
Added
|
|
20
|
+
|
|
21
|
+
- Forty-eight more neighborhoods as search centers for `dogpolicies_near`,
|
|
22
|
+
`dogpolicies_plan_trip` and every tool that takes a place: the rest of the
|
|
23
|
+
San Fernando Valley and the Westside, Koreatown, Downtown Los Angeles, Echo
|
|
24
|
+
Park, Los Feliz, Highland Park, San Francisco's districts (the Mission, the
|
|
25
|
+
Castro, Noe Valley, the Marina, the Richmond and Sunset districts,
|
|
26
|
+
Haight-Ashbury, SoMa, North Beach and more), Rockridge and Temescal, Midtown
|
|
27
|
+
Sacramento, Willow Glen, La Jolla, Pacific Beach, Mission Beach, Hillcrest,
|
|
28
|
+
North Park, Point Loma, the Gaslamp Quarter, the Las Vegas Strip, Summerlin
|
|
29
|
+
and Downtown Las Vegas; and the names people say for them ("Venice Beach",
|
|
30
|
+
"DTLA", "K-town", "the Mission", "SoMa", "the Strip", "Fremont Street").
|
|
31
|
+
- `createServer(ctx, { build })`: an optional build id, reported after the
|
|
32
|
+
package version as semver build metadata (`0.4.1+6a974ec`). The hosted
|
|
33
|
+
server sets it to the deployed commit so a deploy can recognize its own code;
|
|
34
|
+
the stdio server reports the bare version as before.
|
|
35
|
+
|
|
36
|
+
Hosted server (dogpolicies.com/mcp/)
|
|
37
|
+
|
|
38
|
+
- A POST whose `Accept` header lists only `application/json`, or nothing, is
|
|
39
|
+
answered instead of refused with 406; a CORS preflight is answered; a person
|
|
40
|
+
who opens the address in a browser sees how to connect instead of a 405.
|
|
41
|
+
- After `initialize` the server hands out an `mcp-session-id` that carries the
|
|
42
|
+
client's own name and version as a label (no state behind it; the transport
|
|
43
|
+
stays stateless), so the usage tally names clients on every protocol
|
|
44
|
+
version, not only the newest. A request without one is named by a
|
|
45
|
+
User-Agent that identifies an assistant.
|
|
46
|
+
|
|
47
|
+
## 0.4.0 - 2026-11-07
|
|
48
|
+
|
|
49
|
+
Answers, not errors. A question the data cannot answer now comes back as a
|
|
50
|
+
normal answer that says so and helps, never as a dead end, and `isError` is
|
|
51
|
+
reserved for the server itself failing. Directories that score a server by
|
|
52
|
+
its `isError` rate (Claude's does) had been counting "Van Nuys is not a town
|
|
53
|
+
we cover" against us; what they count now is what a person would call an
|
|
54
|
+
error.
|
|
55
|
+
|
|
56
|
+
Changed
|
|
57
|
+
|
|
58
|
+
- `not_found`, `invalid`, `unavailable` and `offline` results are no longer
|
|
59
|
+
`isError`. They are answers with `outcome` (`no_match`, `bad_input`,
|
|
60
|
+
`partial` or `unavailable`), `code`, `message`, and whichever of
|
|
61
|
+
`did_you_mean` (close matches: towns, places, slugs, brands), `nearest` (the
|
|
62
|
+
nearest records anyway, with distance), `missing` and `next` (what to call)
|
|
63
|
+
apply. Every such answer still satisfies the tool's output schema: list
|
|
64
|
+
fields are empty, counts are zero, and a field with nothing honest to hold
|
|
65
|
+
is `null` (`near.center`, `get_rule.rule` and `.place`,
|
|
66
|
+
`i5_conditions.fetched_at`, `get_place.freshness` in a no-match answer).
|
|
67
|
+
A client that branched on `isError` for these codes should read `outcome`.
|
|
68
|
+
`isError` remains for `internal` and `rate_limited`.
|
|
69
|
+
- `dogpolicies_near` widens its radius on its own (30, 60, then 100 miles,
|
|
70
|
+
reported as `radius_widened_from`) when nothing sits inside the one asked
|
|
71
|
+
for, and when the data has nothing within 100 miles it lists the five
|
|
72
|
+
nearest records and the nearest towns with records.
|
|
73
|
+
- `dogpolicies_get_place` and `dogpolicies_compare_places` resolve a near
|
|
74
|
+
miss (a misspelled id, a name a word off) to the one clear match, labeled
|
|
75
|
+
`resolved_from`; `compare_places` compares what it found and lists the
|
|
76
|
+
rest under `missing` (`outcome: partial`).
|
|
77
|
+
- `dogpolicies_get_rule` with a rule id whose place exists but has no such
|
|
78
|
+
rule answers with that place and its recorded rule ids.
|
|
79
|
+
- `dogpolicies_browse_answers` with an unknown slug answers with the closest
|
|
80
|
+
slugs and the whole list; `dogpolicies_get_brand_policy` with an unknown
|
|
81
|
+
brand lists the covered brands nearest in spelling and how to check that
|
|
82
|
+
chain's hotels one by one.
|
|
83
|
+
- `dogpolicies_report_correction` with an unknown place answers
|
|
84
|
+
`bad_input` with close matches and files nothing; an unreachable inbox is
|
|
85
|
+
`unavailable` with the form's address.
|
|
86
|
+
- `dogpolicies_i5_conditions` reads the conditions document in-process on
|
|
87
|
+
the hosted server (it had been answering `offline` there since 0.3.0), marks
|
|
88
|
+
a reading older than two hours `stale`, and when no document can be read
|
|
89
|
+
answers `unavailable` with the live page's address. A point too far from
|
|
90
|
+
I-5 (also in `dogpolicies_i5_corridor`) answers `bad_input` with
|
|
91
|
+
`nearest_i5`: the nearest mile and how far it is.
|
|
92
|
+
- Numeric inputs accept numbers written as strings; `dogs` up to 10, `nights`
|
|
93
|
+
up to 90, `dog_weight_lb` up to 300, `max_total_fee` up to 10,000.
|
|
94
|
+
- The server instructions tell the model there are no dead ends and how to
|
|
95
|
+
use `outcome`, `did_you_mean`, `nearest` and `next`.
|
|
96
|
+
|
|
97
|
+
Fixed
|
|
98
|
+
|
|
99
|
+
- On I-5, `dogpolicies_route_stops`, `dogpolicies_i5_corridor` and the
|
|
100
|
+
drive leg of `dogpolicies_plan_trip` left out every park, hotel, campground
|
|
101
|
+
and patio on the far bank of the freeway: 195 of 422 stops northbound, 199
|
|
102
|
+
southbound (since 0.3.0). The geometric side of the road is now wording
|
|
103
|
+
only; a stop is one-way only when Caltrans lists it for one direction (a
|
|
104
|
+
rest area).
|
|
105
|
+
- The site's in-process server (`npm run preview`, stdio) now carries the
|
|
106
|
+
I-5 axis like the hosted Worker, so the three servers answer alike.
|
|
107
|
+
|
|
108
|
+
Added
|
|
109
|
+
|
|
110
|
+
- Output fields on every tool: `outcome`, `code`, `message`, `did_you_mean`,
|
|
111
|
+
`nearest`, `next` (all optional); `near.radius_widened_from` and `.nearest`;
|
|
112
|
+
`get_place.resolved_from`; `compare_places.missing`;
|
|
113
|
+
`i5_conditions.stale` and `.nearest_i5`; `i5_corridor.nearest_i5`;
|
|
114
|
+
`report_correction.form_url`.
|
|
115
|
+
|
|
13
116
|
## 0.3.0 - 2026-11-04
|
|
14
117
|
|
|
15
118
|
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`.
|
|
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
|
|
package/data/snapshot.json.gz
CHANGED
|
Binary file
|
package/docs/architecture.md
CHANGED
|
@@ -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.
|
|
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
|
+
dogpolicies-mcp 0.4.1, 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
|
|
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
|
|
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
|
|
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
|
|
124
|
-
| `dogs` | integer (min 1, max
|
|
125
|
-
| `nights` | integer (min 1, max
|
|
126
|
-
| `max_total_fee` | number (min 0, max
|
|
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
|
|
157
|
-
| `dogs` | integer (min 1, max
|
|
158
|
-
| `nights` | integer (min 1, max
|
|
159
|
-
| `max_total_fee` | number (min 0, max
|
|
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
|
|
244
|
-
| `dogs` | integer (min 1, max
|
|
245
|
-
| `nights` | integer (min 1, max
|
|
246
|
-
| `max_total_fee` | number (min 0, max
|
|
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.
|
|
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
|
|
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
|
|
package/docs/versioning.md
CHANGED
|
@@ -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
|
-
-
|
|
25
|
-
`
|
|
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
|
+
"version": "0.4.1",
|
|
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.4.1",
|
|
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.4.1",
|
|
18
18
|
"runtimeHint": "npx",
|
|
19
19
|
"transport": {
|
|
20
20
|
"type": "stdio"
|
package/src/core/errors.mjs
CHANGED
|
@@ -1,7 +1,70 @@
|
|
|
1
|
-
// The error model every tool shares. A tool never throws at a client
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
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({
|