@cyanheads/libofcongress-mcp-server 0.2.4 → 0.2.6
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/CLAUDE.md +14 -37
- package/README.md +1 -1
- package/dist/config/server-config.js +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-browse-collections.tool.d.ts +4 -7
- package/dist/mcp-server/tools/definitions/libofcongress-browse-collections.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-browse-collections.tool.js +21 -37
- package/dist/mcp-server/tools/definitions/libofcongress-browse-collections.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-get-item.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-get-item.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-get-newspaper-page.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-get-newspaper-page.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-search-newspapers.tool.d.ts +5 -7
- package/dist/mcp-server/tools/definitions/libofcongress-search-newspapers.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-search-newspapers.tool.js +27 -40
- package/dist/mcp-server/tools/definitions/libofcongress-search-newspapers.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-search-subjects.tool.d.ts +4 -8
- package/dist/mcp-server/tools/definitions/libofcongress-search-subjects.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-search-subjects.tool.js +13 -19
- package/dist/mcp-server/tools/definitions/libofcongress-search-subjects.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-search.tool.d.ts +5 -7
- package/dist/mcp-server/tools/definitions/libofcongress-search.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/libofcongress-search.tool.js +25 -40
- package/dist/mcp-server/tools/definitions/libofcongress-search.tool.js.map +1 -1
- package/package.json +7 -7
- package/server.json +5 -5
- package/dist/libofcongress-mcp-server.mcpb +0 -0
package/CLAUDE.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** libofcongress-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.9.
|
|
4
|
+
**Version:** 0.2.6
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.9.16`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
|
|
8
8
|
**Zod:** ^4.4.3
|
|
@@ -113,7 +113,7 @@ import { z } from '@cyanheads/mcp-ts-core';
|
|
|
113
113
|
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
114
114
|
|
|
115
115
|
const ServerConfigSchema = z.object({
|
|
116
|
-
userAgent: z.string().default('libofcongress-mcp-server/0.2.
|
|
116
|
+
userAgent: z.string().default('libofcongress-mcp-server/0.2.6').describe('User-Agent header for LOC API requests.'),
|
|
117
117
|
requestDelayMs: z.coerce.number().default(3100).describe('Delay in ms between LOC API requests.'),
|
|
118
118
|
});
|
|
119
119
|
|
|
@@ -155,6 +155,8 @@ Handlers throw — the framework catches, classifies, and formats.
|
|
|
155
155
|
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required descriptive metadata for the agent's next move (≥ 5 words, lint-validated); for the wire `data.recovery.hint` (mirrored into `content[]` text), pass explicitly at the throw site when dynamic context matters: `ctx.fail('reason', msg, { recovery: { hint: '...' } })`. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
156
156
|
|
|
157
157
|
```ts
|
|
158
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
159
|
+
|
|
158
160
|
errors: [
|
|
159
161
|
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound,
|
|
160
162
|
when: 'No item matched the query',
|
|
@@ -248,9 +250,13 @@ Available skills:
|
|
|
248
250
|
| `add-service` | Scaffold a new service integration |
|
|
249
251
|
| `add-test` | Scaffold test file for a tool, resource, or service |
|
|
250
252
|
| `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
|
|
253
|
+
| `tool-defs-analysis` | Read-only audit of MCP definition language across the surface — voice, leaks, defaults, recovery hints, output descriptions |
|
|
251
254
|
| `security-pass` | Audit server for MCP-flavored security gaps: output injection, scope blast radius, input sinks, tenant isolation |
|
|
255
|
+
| `code-simplifier` | Post-session cleanup against `git diff` — modernize syntax, consolidate duplication, align with the codebase |
|
|
252
256
|
| `devcheck` | Lint, format, typecheck, audit |
|
|
253
257
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
258
|
+
| `git-wrapup` | Land working-tree changes as a versioned commit + annotated tag — version bump, changelog, verify, tag. Local only. |
|
|
259
|
+
| `release-and-publish` | Push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
254
260
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
255
261
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
256
262
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
@@ -259,6 +265,7 @@ Available skills:
|
|
|
259
265
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
260
266
|
| `api-context` | Context interface, logger, state, progress |
|
|
261
267
|
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
268
|
+
| `api-linter` | Definition linter rule catalog — invoked by `bun run lint:mcp` and `devcheck` |
|
|
262
269
|
| `api-services` | LLM, Speech, Graph services |
|
|
263
270
|
| `api-testing` | createMockContext, test patterns |
|
|
264
271
|
| `api-utils` | Formatting, parsing, security, pagination, scheduling, telemetry helpers |
|
|
@@ -297,40 +304,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
297
304
|
|
|
298
305
|
**Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match.
|
|
299
306
|
|
|
300
|
-
**README install badges
|
|
301
|
-
|
|
302
|
-
| Client | Mechanism |
|
|
303
|
-
|:-------|:----------|
|
|
304
|
-
| Claude Desktop | Browser downloads the `.mcpb` from the latest GitHub Release; OS file handler routes it to Claude Desktop, which opens the install dialog. No deep-link URL scheme yet — this is the canonical path. |
|
|
305
|
-
| Cursor | Official `https://cursor.com/en/install-mcp` endpoint with base64 JSON config. |
|
|
306
|
-
| VS Code / Insiders | Official `vscode:mcp/install?...` deep link, wrapped in `https://vscode.dev/redirect?url=` so GitHub-rendered markdown doesn't strip the non-HTTP scheme. |
|
|
307
|
-
| Claude Code / Codex | CLI only (`claude mcp add` / `codex mcp add`); no URL scheme. |
|
|
308
|
-
|
|
309
|
-
```markdown
|
|
310
|
-
[](https://github.com/<OWNER>/<REPO>/releases/latest/download/<PACKAGE_NAME>.mcpb)
|
|
311
|
-
[](https://cursor.com/en/install-mcp?name=<PACKAGE_NAME>&config=<BASE64_CONFIG>)
|
|
312
|
-
[](https://vscode.dev/redirect?url=vscode:mcp/install?<URLENCODED_JSON>)
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
Both install links route through HTTPS endpoints (`cursor.com/en/install-mcp` and `vscode.dev/redirect`) — GitHub-rendered markdown strips non-HTTP URL schemes from anchors, so a raw `cursor://` or `vscode:` link won't click through from github.com.
|
|
316
|
-
|
|
317
|
-
Generate the encoded configs (replace `<PACKAGE_NAME>` and add env vars for any required API keys):
|
|
318
|
-
|
|
319
|
-
```bash
|
|
320
|
-
# Cursor: base64-encoded JSON. Split command/args, add env when keys are needed.
|
|
321
|
-
echo -n '{"command":"npx","args":["-y","<PACKAGE_NAME>"],"env":{"API_KEY":"your-api-key"}}' | base64
|
|
322
|
-
# Without env (no required keys):
|
|
323
|
-
echo -n '{"command":"npx","args":["-y","<PACKAGE_NAME>"]}' | base64
|
|
324
|
-
|
|
325
|
-
# VS Code: URL-encoded JSON. Same shape plus a `name` field.
|
|
326
|
-
node -p 'encodeURIComponent(JSON.stringify({name:"<SHORT_NAME>",command:"npx",args:["-y","<PACKAGE_NAME>"],env:{API_KEY:"your-api-key"}}))'
|
|
327
|
-
# Without env:
|
|
328
|
-
node -p 'encodeURIComponent(JSON.stringify({name:"<SHORT_NAME>",command:"npx",args:["-y","<PACKAGE_NAME>"]}))'
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
Both clients use the same `{command, args, env}` shape (matching `mcp.json` schema). VS Code adds a top-level `name` field. Omit `env` entirely when no API keys are needed — don't include empty objects or framework-only vars like `MCP_TRANSPORT_TYPE`.
|
|
332
|
-
|
|
333
|
-
The Claude Desktop badge requires the bundle to ship with a stable filename — `bun run bundle` outputs `dist/<PACKAGE_NAME>.mcpb`, and `release-and-publish` attaches that file to the GitHub Release. `releases/latest/download/<PACKAGE_NAME>.mcpb` then redirects to the most recent release.
|
|
307
|
+
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
|
|
334
308
|
|
|
335
309
|
---
|
|
336
310
|
|
|
@@ -385,4 +359,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
|
|
|
385
359
|
- [ ] If wrapping external API: tests include at least one sparse payload case with omitted upstream fields
|
|
386
360
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
387
361
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
362
|
+
- [ ] `.codex-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; `interface.displayName` = package name; `interface.shortDescription` from `package.json` description
|
|
363
|
+
- [ ] `.codex-plugin/mcp.json` updated — server name key matches `package.json` name; env vars added for any required API keys
|
|
364
|
+
- [ ] `.claude-plugin/plugin.json` populated — `name`, `version`, `description`, `repository`, `license` from `package.json`; inline `mcpServers` entry with server name key, env vars for any required API keys
|
|
388
365
|
- [ ] `npm run devcheck` passes
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/libofcongress-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/libofcongress-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
|
7
7
|
const ServerConfigSchema = z.object({
|
|
8
8
|
userAgent: z
|
|
9
9
|
.string()
|
|
10
|
-
.default('libofcongress-mcp-server/0.2.
|
|
10
|
+
.default('libofcongress-mcp-server/0.2.6')
|
|
11
11
|
.describe('User-Agent header sent with LOC API requests. LOC recommends a descriptive value for polite access.'),
|
|
12
12
|
requestDelayMs: z.coerce
|
|
13
13
|
.number()
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,10 @@ await createApp({
|
|
|
27
27
|
instructions: 'Library of Congress digital collections server. Use libofcongress_search_subjects to find exact LCSH terms before subject-filtering libofcongress_search. ' +
|
|
28
28
|
'Newspaper research: libofcongress_search_newspapers → libofcongress_get_newspaper_page (two hops). ' +
|
|
29
29
|
'Rate limit: 20 req/min; violations block for 1 hour.',
|
|
30
|
+
landing: {
|
|
31
|
+
// Public hosted catalog — serve full inventory without auth requirement.
|
|
32
|
+
requireAuth: false,
|
|
33
|
+
},
|
|
30
34
|
setup(core) {
|
|
31
35
|
initLocApiService(core.config, core.storage);
|
|
32
36
|
initLcLinkedDataService(core.config, core.storage);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,mEAAmE,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,yEAAyE,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,MAAM,+DAA+D,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yEAAyE,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,6DAA6D,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wEAAwE,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,sEAAsE,CAAC;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,SAAS,CAAC;IACd,KAAK,EAAE;QACL,SAAS;QACT,UAAU;QACV,mBAAmB;QACnB,mBAAmB;QACnB,iBAAiB;QACjB,oBAAoB;KACrB;IACD,SAAS,EAAE,CAAC,eAAe,CAAC;IAC5B,OAAO,EAAE,EAAE;IACX,YAAY,EACV,4JAA4J;QAC5J,qGAAqG;QACrG,sDAAsD;IACxD,KAAK,CAAC,IAAI;QACR,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;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16 +20,13 @@ export declare const locBrowseCollections: import("@cyanheads/mcp-ts-core").Tool
|
|
|
20
20
|
page: z.ZodNumber;
|
|
21
21
|
pages: z.ZodNumber;
|
|
22
22
|
has_next: z.ZodBoolean;
|
|
23
|
-
message: z.ZodOptional<z.ZodString>;
|
|
24
23
|
}, z.core.$strip>, readonly [{
|
|
25
|
-
readonly reason: "empty_results";
|
|
26
|
-
readonly code: JsonRpcErrorCode.NotFound;
|
|
27
|
-
readonly when: "No collections matched the keyword filter.";
|
|
28
|
-
readonly recovery: "Broaden the keyword or call without a query to list all LOC digital collections.";
|
|
29
|
-
}, {
|
|
30
24
|
readonly reason: "rate_limit_exceeded";
|
|
31
25
|
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
32
26
|
readonly when: "LOC API rate limit exceeded; requests are blocked for approximately 1 hour.";
|
|
33
27
|
readonly recovery: "Wait approximately 1 hour before retrying. Reduce request frequency to stay under 20 req/min.";
|
|
34
|
-
}]
|
|
28
|
+
}], {
|
|
29
|
+
readonly totalCount: z.ZodNumber;
|
|
30
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}>;
|
|
35
32
|
//# sourceMappingURL=libofcongress-browse-collections.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-browse-collections.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-browse-collections.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"libofcongress-browse-collections.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-browse-collections.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;EAkJ/B,CAAC"}
|
|
@@ -52,18 +52,21 @@ export const locBrowseCollections = tool('libofcongress_browse_collections', {
|
|
|
52
52
|
page: z.number().describe('Current 1-indexed page number.'),
|
|
53
53
|
pages: z.number().describe('Total number of pages available.'),
|
|
54
54
|
has_next: z.boolean().describe('True when more pages are available after this one.'),
|
|
55
|
-
|
|
55
|
+
}),
|
|
56
|
+
// Agent-facing success-path context — result count and empty-result guidance. Reaches
|
|
57
|
+
// both structuredContent and content[] automatically; kept out of the domain output.
|
|
58
|
+
// No effectiveQuery: query is optional (browse-all default) so the echo is N/A when absent.
|
|
59
|
+
// Keys are disjoint from output (total vs totalCount).
|
|
60
|
+
enrichment: {
|
|
61
|
+
totalCount: z
|
|
62
|
+
.number()
|
|
63
|
+
.describe('Total matching collections — mirrors output.total for agent reasoning.'),
|
|
64
|
+
notice: z
|
|
56
65
|
.string()
|
|
57
66
|
.optional()
|
|
58
|
-
.describe('Recovery hint when results are empty — suggests broadening the keyword. Absent on
|
|
59
|
-
}
|
|
67
|
+
.describe('Recovery hint when results are empty or a page is out of range — suggests broadening the keyword or removing filters. Absent on successful result pages.'),
|
|
68
|
+
},
|
|
60
69
|
errors: [
|
|
61
|
-
{
|
|
62
|
-
reason: 'empty_results',
|
|
63
|
-
code: JsonRpcErrorCode.NotFound,
|
|
64
|
-
when: 'No collections matched the keyword filter.',
|
|
65
|
-
recovery: 'Broaden the keyword or call without a query to list all LOC digital collections.',
|
|
66
|
-
},
|
|
67
70
|
{
|
|
68
71
|
reason: 'rate_limit_exceeded',
|
|
69
72
|
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
@@ -80,40 +83,23 @@ export const locBrowseCollections = tool('libofcongress_browse_collections', {
|
|
|
80
83
|
page: input.page,
|
|
81
84
|
}, ctx);
|
|
82
85
|
const { total, page, pages, hasNext } = result.pagination;
|
|
86
|
+
ctx.enrich.total(total);
|
|
83
87
|
if (result.items.length === 0) {
|
|
84
88
|
// Out-of-range page: service returned null (LOC 400) — pages is 0 here.
|
|
85
89
|
// Distinguish from a genuine empty result by checking page > 1.
|
|
86
90
|
if (page > 1 && pages === 0) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
total: 0,
|
|
90
|
-
page,
|
|
91
|
-
pages: 0,
|
|
92
|
-
has_next: false,
|
|
93
|
-
message: `Page ${page} is out of range. Try a smaller page number.`,
|
|
94
|
-
};
|
|
91
|
+
ctx.enrich.notice(`Page ${page} is out of range. Try a smaller page number.`);
|
|
92
|
+
return { collections: [], total: 0, page, pages: 0, has_next: false };
|
|
95
93
|
}
|
|
96
|
-
|
|
97
|
-
collections
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
pages: 0,
|
|
101
|
-
has_next: false,
|
|
102
|
-
message: input.query
|
|
103
|
-
? `No collections matched "${input.query}". Try a broader keyword or call without a query to list all LOC digital collections.`
|
|
104
|
-
: 'No collections found. The LOC collections endpoint may be temporarily unavailable.',
|
|
105
|
-
};
|
|
94
|
+
ctx.enrich.notice(input.query
|
|
95
|
+
? `No collections matched "${input.query}". Try a broader keyword or call without a query to list all LOC digital collections.`
|
|
96
|
+
: 'No collections found. The LOC collections endpoint may be temporarily unavailable.');
|
|
97
|
+
return { collections: [], total: 0, page, pages: 0, has_next: false };
|
|
106
98
|
}
|
|
107
99
|
// Detect contradictory pagination: LOC sometimes returns items on out-of-range pages.
|
|
108
100
|
if (pages > 0 && page > pages) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
total,
|
|
112
|
-
page,
|
|
113
|
-
pages,
|
|
114
|
-
has_next: false,
|
|
115
|
-
message: `No results on page ${page} — there are ${pages} page(s) total (${total} collections). Use a page number between 1 and ${pages}.`,
|
|
116
|
-
};
|
|
101
|
+
ctx.enrich.notice(`No results on page ${page} — there are ${pages} page(s) total (${total} collections). Use a page number between 1 and ${pages}.`);
|
|
102
|
+
return { collections: [], total, page, pages, has_next: false };
|
|
117
103
|
}
|
|
118
104
|
return {
|
|
119
105
|
collections: result.items,
|
|
@@ -126,8 +112,6 @@ export const locBrowseCollections = tool('libofcongress_browse_collections', {
|
|
|
126
112
|
format: (result) => {
|
|
127
113
|
const lines = [];
|
|
128
114
|
lines.push(`**Total:** ${result.total} | **Page:** ${result.page} of ${result.pages} | **has_next:** ${result.has_next}`);
|
|
129
|
-
if (result.message)
|
|
130
|
-
lines.push(`\n> ${result.message}`);
|
|
131
115
|
for (const col of result.collections) {
|
|
132
116
|
lines.push(`\n## ${col.title}`);
|
|
133
117
|
lines.push(`**Slug:** ${col.slug}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-browse-collections.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-browse-collections.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,kCAAkC,EAAE;IAC3E,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EACT,gYAAgY;IAClY,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IACxD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,8FAA8F,CAC/F;QACH,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,GAAG,CAAC;aACR,OAAO,CAAC,EAAE,CAAC;aACX,QAAQ,CAAC,+DAA+D,CAAC;QAC5E,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC,CAAC,CAAC;aACN,OAAO,CAAC,CAAC,CAAC;aACV,QAAQ,CAAC,+CAA+C,CAAC;KAC7D,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,WAAW,EAAE,CAAC;aACX,KAAK,CACJ,CAAC;aACE,MAAM,CAAC;YACN,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,CAAC,sEAAsE,CAAC;YACnF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC9C,WAAW,EAAE,CAAC;iBACX,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,qDAAqD,CAAC;YAClE,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,2EAA2E,CAC5E;YACH,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;SACvD,CAAC;aACD,QAAQ,CAAC,0CAA0C,CAAC,CACxD;aACA,QAAQ,CACP,uGAAuG,CACxG;QACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;QACpF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;QAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QAC9D,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;
|
|
1
|
+
{"version":3,"file":"libofcongress-browse-collections.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-browse-collections.tool.ts"],"names":[],"mappings":"AAAA;;;G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sonRpcErrorCode.ServiceUnavailable;
|
|
29
29
|
readonly when: "LOC API rate limit exceeded; requests are blocked for approximately 1 hour.";
|
|
30
30
|
readonly recovery: "Wait approximately 1 hour before retrying. Reduce request frequency to stay under 20 req/min.";
|
|
31
|
-
}]>;
|
|
31
|
+
}], undefined>;
|
|
32
32
|
//# sourceMappingURL=libofcongress-get-item.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-get-item.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-get-item.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAG3E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"libofcongress-get-item.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-get-item.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAG3E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;cAuGrB,CAAC"}
|
|
@@ -25,5 +25,5 @@ export declare const locGetNewspaperPage: import("@cyanheads/mcp-ts-core").ToolD
|
|
|
25
25
|
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
26
26
|
readonly when: "LOC API rate limit exceeded; requests are blocked for approximately 1 hour.";
|
|
27
27
|
readonly recovery: "Wait approximately 1 hour before retrying. Reduce request frequency to stay under 20 req/min.";
|
|
28
|
-
}]>;
|
|
28
|
+
}], undefined>;
|
|
29
29
|
//# sourceMappingURL=libofcongress-get-newspaper-page.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-get-newspaper-page.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-get-newspaper-page.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAA6B,MAAM,+BAA+B,CAAC;AAK5F,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"libofcongress-get-newspaper-page.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-get-newspaper-page.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAA6B,MAAM,+BAA+B,CAAC;AAK5F,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;cA2F9B,CAAC"}
|
|
@@ -25,16 +25,14 @@ export declare const locSearchNewspapers: import("@cyanheads/mcp-ts-core").ToolD
|
|
|
25
25
|
page: z.ZodNumber;
|
|
26
26
|
pages: z.ZodNumber;
|
|
27
27
|
has_next: z.ZodBoolean;
|
|
28
|
-
message: z.ZodOptional<z.ZodString>;
|
|
29
28
|
}, z.core.$strip>, readonly [{
|
|
30
|
-
readonly reason: "empty_results";
|
|
31
|
-
readonly code: JsonRpcErrorCode.NotFound;
|
|
32
|
-
readonly when: "No newspaper pages matched the query and filters.";
|
|
33
|
-
readonly recovery: "Broaden the date range, remove the state filter, or try different keywords. OCR search is approximate — spelling variations in historical text are common.";
|
|
34
|
-
}, {
|
|
35
29
|
readonly reason: "rate_limit_exceeded";
|
|
36
30
|
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
37
31
|
readonly when: "LOC API rate limit exceeded; requests are blocked for approximately 1 hour.";
|
|
38
32
|
readonly recovery: "Wait approximately 1 hour before retrying. Reduce request frequency to stay under 20 req/min.";
|
|
39
|
-
}]
|
|
33
|
+
}], {
|
|
34
|
+
readonly effectiveQuery: z.ZodString;
|
|
35
|
+
readonly totalCount: z.ZodNumber;
|
|
36
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}>;
|
|
40
38
|
//# sourceMappingURL=libofcongress-search-newspapers.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-search-newspapers.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search-newspapers.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,+BAA+B,CAAC;AAGlF,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"libofcongress-search-newspapers.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search-newspapers.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,+BAA+B,CAAC;AAGlF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4L9B,CAAC"}
|
|
@@ -69,18 +69,23 @@ export const locSearchNewspapers = tool('libofcongress_search_newspapers', {
|
|
|
69
69
|
page: z.number().describe('Current 1-indexed page number.'),
|
|
70
70
|
pages: z.number().describe('Total number of pages available.'),
|
|
71
71
|
has_next: z.boolean().describe('True when more pages are available after this one.'),
|
|
72
|
-
|
|
72
|
+
}),
|
|
73
|
+
// Agent-facing success-path context — query echo, result count, and empty-result
|
|
74
|
+
// guidance. Reaches both structuredContent and content[] automatically; kept out of
|
|
75
|
+
// the domain output. Keys are disjoint from output (total vs totalCount).
|
|
76
|
+
enrichment: {
|
|
77
|
+
effectiveQuery: z
|
|
78
|
+
.string()
|
|
79
|
+
.describe('The keyword query as submitted to the Chronicling America API, after trimming.'),
|
|
80
|
+
totalCount: z
|
|
81
|
+
.number()
|
|
82
|
+
.describe('Total matching newspaper pages — mirrors output.total for agent reasoning.'),
|
|
83
|
+
notice: z
|
|
73
84
|
.string()
|
|
74
85
|
.optional()
|
|
75
|
-
.describe('Recovery hint when results are empty — echoes
|
|
76
|
-
}
|
|
86
|
+
.describe('Recovery hint when results are empty or a page is out of range — echoes applied filters and suggests how to broaden. Absent on successful result pages.'),
|
|
87
|
+
},
|
|
77
88
|
errors: [
|
|
78
|
-
{
|
|
79
|
-
reason: 'empty_results',
|
|
80
|
-
code: JsonRpcErrorCode.NotFound,
|
|
81
|
-
when: 'No newspaper pages matched the query and filters.',
|
|
82
|
-
recovery: 'Broaden the date range, remove the state filter, or try different keywords. OCR search is approximate — spelling variations in historical text are common.',
|
|
83
|
-
},
|
|
84
89
|
{
|
|
85
90
|
reason: 'rate_limit_exceeded',
|
|
86
91
|
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
@@ -110,41 +115,25 @@ export const locSearchNewspapers = tool('libofcongress_search_newspapers', {
|
|
|
110
115
|
page: input.page,
|
|
111
116
|
}, ctx);
|
|
112
117
|
const { total, page, pages, hasNext } = result.pagination;
|
|
118
|
+
ctx.enrich.echo(input.query);
|
|
119
|
+
ctx.enrich.total(total);
|
|
113
120
|
if (result.items.length === 0) {
|
|
114
121
|
// pages === 0 is the sentinel for a LOC 400 (out-of-range page request).
|
|
115
122
|
if (pages === 0 && page > 1) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
total: 0,
|
|
119
|
-
page,
|
|
120
|
-
pages: 0,
|
|
121
|
-
has_next: false,
|
|
122
|
-
message: `Page ${page} is out of range for query "${input.query}". Try a smaller page number.`,
|
|
123
|
-
};
|
|
123
|
+
ctx.enrich.notice(`Page ${page} is out of range for query "${input.query}". Try a smaller page number.`);
|
|
124
|
+
return { items: [], total: 0, page, pages: 0, has_next: false };
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
(input.state ? ` in state "${input.state}"` : '') +
|
|
133
|
-
(input.date_start || input.date_end
|
|
134
|
-
? ` in dates ${input.date_start ?? ''}–${input.date_end ?? ''}`
|
|
135
|
-
: '') +
|
|
136
|
-
'. Try broadening the date range, removing the state filter, or using different keywords. Historical OCR is approximate — variant spellings are common.',
|
|
137
|
-
};
|
|
126
|
+
ctx.enrich.notice(`No newspaper pages matched "${input.query}"` +
|
|
127
|
+
(input.state ? ` in state "${input.state}"` : '') +
|
|
128
|
+
(input.date_start || input.date_end
|
|
129
|
+
? ` in dates ${input.date_start ?? ''}–${input.date_end ?? ''}`
|
|
130
|
+
: '') +
|
|
131
|
+
'. Try broadening the date range, removing the state filter, or using different keywords. Historical OCR is approximate — variant spellings are common.');
|
|
132
|
+
return { items: [], total: 0, page, pages: 0, has_next: false };
|
|
138
133
|
}
|
|
139
134
|
if (pages > 0 && page > pages) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
total,
|
|
143
|
-
page,
|
|
144
|
-
pages,
|
|
145
|
-
has_next: false,
|
|
146
|
-
message: `No results on page ${page} — query has ${pages} page(s) total (${total} items). Use a page number between 1 and ${pages}.`,
|
|
147
|
-
};
|
|
135
|
+
ctx.enrich.notice(`No results on page ${page} — query has ${pages} page(s) total (${total} items). Use a page number between 1 and ${pages}.`);
|
|
136
|
+
return { items: [], total, page, pages, has_next: false };
|
|
148
137
|
}
|
|
149
138
|
return {
|
|
150
139
|
items: result.items,
|
|
@@ -157,8 +146,6 @@ export const locSearchNewspapers = tool('libofcongress_search_newspapers', {
|
|
|
157
146
|
format: (result) => {
|
|
158
147
|
const lines = [];
|
|
159
148
|
lines.push(`**Total:** ${result.total} | **Page:** ${result.page} of ${result.pages} | **has_next:** ${result.has_next}`);
|
|
160
|
-
if (result.message)
|
|
161
|
-
lines.push(`\n> ${result.message}`);
|
|
162
149
|
for (const item of result.items) {
|
|
163
150
|
lines.push(`\n## ${item.title}`);
|
|
164
151
|
if (item.newspaper_title)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-search-newspapers.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search-newspapers.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,iCAAiC,EAAE;IACzE,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,6hBAA6hB;IAC/hB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IACxD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,wDAAwD,CAAC;QACrE,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,EAAE;aACL,QAAQ,EAAE;aACV,QAAQ,CAAC,8EAA8E,CAAC;QAC3F,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,GAAG,EAAE;aACL,QAAQ,EAAE;aACV,QAAQ,CAAC,4EAA4E,CAAC;QACzF,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,qHAAqH,CACtH;QACH,eAAe,EAAE,CAAC;aACf,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,mEAAmE,CAAC;QAChF,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR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C,CAAC;QAC9D,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;
|
|
1
|
+
{"version":3,"file":"libofcongress-search-newspapers.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search-newspapers.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,iCAAiC,EAAE;IACzE,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,6hBAA6hB;IAC/hB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IACxD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,wDAAwD,CAAC;QACrE,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,EAAE;aACL,QAAQ,EAAE;aACV,QAAQ,CAAC,8EAA8E,CAAC;QAC3F,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,GAAG,EAAE;aACL,QAAQ,EAAE;aACV,QAAQ,CAAC,4EAA4E,CAAC;QACzF,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,qHAAqH,CACtH;QACH,eAAe,EAAE,CAAC;aACf,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,mEAAmE,CAAC;QAChF,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC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AK,EAAE,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACjC,IAAI,IAAI,CAAC,eAAe;gBAAE,KAAK,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;YACjF,IAAI,IAAI,CAAC,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACpD,IAAI,IAAI,CAAC,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACvD,IAAI,IAAI,CAAC,WAAW;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @module mcp-server/tools/definitions/libofcongress-search-subjects.tool
|
|
4
4
|
*/
|
|
5
5
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
-
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
6
|
export declare const locSearchSubjects: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
7
|
query: z.ZodString;
|
|
9
8
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
@@ -14,11 +13,8 @@ export declare const locSearchSubjects: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
14
13
|
count: z.ZodOptional<z.ZodNumber>;
|
|
15
14
|
}, z.core.$strip>>;
|
|
16
15
|
total: z.ZodNumber;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
readonly
|
|
20
|
-
|
|
21
|
-
readonly when: "No LCSH headings matched the query.";
|
|
22
|
-
readonly recovery: "Try broader or different terms. LCSH uses inverted forms for many headings (e.g., \"Photography, Aerial\" not \"Aerial photography\").";
|
|
23
|
-
}]>;
|
|
16
|
+
}, z.core.$strip>, undefined, {
|
|
17
|
+
readonly effectiveQuery: z.ZodString;
|
|
18
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}>;
|
|
24
20
|
//# sourceMappingURL=libofcongress-search-subjects.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-search-subjects.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search-subjects.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"libofcongress-search-subjects.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search-subjects.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;EA6F5B,CAAC"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @module mcp-server/tools/definitions/libofcongress-search-subjects.tool
|
|
4
4
|
*/
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
-
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
6
|
import { getLcLinkedDataService } from '../../../services/lc-linked-data/lc-linked-data-service.js';
|
|
8
7
|
export const locSearchSubjects = tool('libofcongress_search_subjects', {
|
|
9
8
|
title: 'Search LC Subject Headings',
|
|
@@ -41,29 +40,26 @@ export const locSearchSubjects = tool('libofcongress_search_subjects', {
|
|
|
41
40
|
.describe('A single LCSH subject heading record.'))
|
|
42
41
|
.describe('LCSH subject headings matching the query, ordered by relevance.'),
|
|
43
42
|
total: z.number().describe('Number of subject headings returned.'),
|
|
44
|
-
|
|
43
|
+
}),
|
|
44
|
+
// Agent-facing success-path context — query echo and empty-result guidance. Reaches
|
|
45
|
+
// both structuredContent and content[] automatically; kept out of the domain output.
|
|
46
|
+
enrichment: {
|
|
47
|
+
effectiveQuery: z
|
|
48
|
+
.string()
|
|
49
|
+
.describe('The keyword query as submitted to the id.loc.gov suggest endpoint, after trimming.'),
|
|
50
|
+
notice: z
|
|
45
51
|
.string()
|
|
46
52
|
.optional()
|
|
47
|
-
.describe('Recovery hint when results are empty — suggests alternative search strategies. Absent on non-empty
|
|
48
|
-
}
|
|
49
|
-
errors: [
|
|
50
|
-
{
|
|
51
|
-
reason: 'empty_results',
|
|
52
|
-
code: JsonRpcErrorCode.NotFound,
|
|
53
|
-
when: 'No LCSH headings matched the query.',
|
|
54
|
-
recovery: 'Try broader or different terms. LCSH uses inverted forms for many headings (e.g., "Photography, Aerial" not "Aerial photography").',
|
|
55
|
-
},
|
|
56
|
-
],
|
|
53
|
+
.describe('Recovery hint when results are empty — suggests alternative LCSH search strategies. Absent on non-empty results.'),
|
|
54
|
+
},
|
|
57
55
|
async handler(input, ctx) {
|
|
58
56
|
ctx.log.info('libofcongress_search_subjects', { query: input.query, limit: input.limit });
|
|
59
57
|
const svc = getLcLinkedDataService();
|
|
60
58
|
const subjects = await svc.searchSubjects(input.query, input.limit, ctx);
|
|
59
|
+
ctx.enrich.echo(input.query);
|
|
61
60
|
if (subjects.length === 0) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
total: 0,
|
|
65
|
-
message: `No LCSH headings matched "${input.query}". Try broader or different terms. LCSH uses inverted forms for many headings — for example, "Photography, Aerial" instead of "Aerial photography", or "World War, 1939-1945" instead of "World War II".`,
|
|
66
|
-
};
|
|
61
|
+
ctx.enrich.notice(`No LCSH headings matched "${input.query}". Try broader or different terms. LCSH uses inverted forms for many headings — for example, "Photography, Aerial" instead of "Aerial photography", or "World War, 1939-1945" instead of "World War II".`);
|
|
62
|
+
return { subjects: [], total: 0 };
|
|
67
63
|
}
|
|
68
64
|
return {
|
|
69
65
|
subjects,
|
|
@@ -73,8 +69,6 @@ export const locSearchSubjects = tool('libofcongress_search_subjects', {
|
|
|
73
69
|
format: (result) => {
|
|
74
70
|
const lines = [];
|
|
75
71
|
lines.push(`**${result.total} subject heading(s) found**`);
|
|
76
|
-
if (result.message)
|
|
77
|
-
lines.push(`\n> ${result.message}`);
|
|
78
72
|
for (const s of result.subjects) {
|
|
79
73
|
lines.push(`\n## ${s.label}`);
|
|
80
74
|
lines.push(`**URI:** ${s.uri}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-search-subjects.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search-subjects.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"libofcongress-search-subjects.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search-subjects.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAE7F,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,+BAA+B,EAAE;IACrE,KAAK,EAAE,4BAA4B;IACnC,WAAW,EACT,sdAAsd;IACxd,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IACxD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC;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37
|
has_next: z.ZodBoolean;
|
|
38
|
-
message: z.ZodOptional<z.ZodString>;
|
|
39
38
|
}, z.core.$strip>, readonly [{
|
|
40
|
-
readonly reason: "empty_results";
|
|
41
|
-
readonly code: JsonRpcErrorCode.NotFound;
|
|
42
|
-
readonly when: "No items matched the query and filters.";
|
|
43
|
-
readonly recovery: "Broaden the query, widen the date range, or use libofcongress_search_subjects to find the correct subject heading spelling.";
|
|
44
|
-
}, {
|
|
45
39
|
readonly reason: "rate_limit_exceeded";
|
|
46
40
|
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
47
41
|
readonly when: "LOC API rate limit exceeded; requests are blocked for approximately 1 hour.";
|
|
48
42
|
readonly recovery: "Wait approximately 1 hour before retrying. Reduce request frequency to stay under 20 req/min.";
|
|
49
|
-
}]
|
|
43
|
+
}], {
|
|
44
|
+
readonly effectiveQuery: z.ZodString;
|
|
45
|
+
readonly totalCount: z.ZodNumber;
|
|
46
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}>;
|
|
50
48
|
//# sourceMappingURL=libofcongress-search.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-search.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,+BAA+B,CAAC;AAGlF,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"libofcongress-search.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,+BAA+B,CAAC;AAGlF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqMpB,CAAC"}
|
|
@@ -73,18 +73,21 @@ export const locSearch = tool('libofcongress_search', {
|
|
|
73
73
|
page: z.number().describe('Current 1-indexed page number.'),
|
|
74
74
|
pages: z.number().describe('Total number of pages available.'),
|
|
75
75
|
has_next: z.boolean().describe('True when more pages are available after this one.'),
|
|
76
|
-
|
|
76
|
+
}),
|
|
77
|
+
// Agent-facing success-path context — query echo, result count, and empty-result
|
|
78
|
+
// guidance. Reaches both structuredContent and content[] automatically; kept out of
|
|
79
|
+
// the domain output. Keys are disjoint from output (total vs totalCount).
|
|
80
|
+
enrichment: {
|
|
81
|
+
effectiveQuery: z.string().describe('The query as submitted to the LOC API, after trimming.'),
|
|
82
|
+
totalCount: z
|
|
83
|
+
.number()
|
|
84
|
+
.describe('Total matching items across all pages — mirrors output.total for agent reasoning.'),
|
|
85
|
+
notice: z
|
|
77
86
|
.string()
|
|
78
87
|
.optional()
|
|
79
|
-
.describe('Recovery hint when results are empty — echoes
|
|
80
|
-
}
|
|
88
|
+
.describe('Recovery hint when results are empty or a page is out of range — echoes applied filters and suggests how to broaden. Absent on successful result pages.'),
|
|
89
|
+
},
|
|
81
90
|
errors: [
|
|
82
|
-
{
|
|
83
|
-
reason: 'empty_results',
|
|
84
|
-
code: JsonRpcErrorCode.NotFound,
|
|
85
|
-
when: 'No items matched the query and filters.',
|
|
86
|
-
recovery: 'Broaden the query, widen the date range, or use libofcongress_search_subjects to find the correct subject heading spelling.',
|
|
87
|
-
},
|
|
88
91
|
{
|
|
89
92
|
reason: 'rate_limit_exceeded',
|
|
90
93
|
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
@@ -115,43 +118,27 @@ export const locSearch = tool('libofcongress_search', {
|
|
|
115
118
|
page: input.page,
|
|
116
119
|
}, ctx);
|
|
117
120
|
const { total, page, pages, hasNext } = result.pagination;
|
|
121
|
+
ctx.enrich.echo(input.query);
|
|
122
|
+
ctx.enrich.total(total);
|
|
118
123
|
if (result.items.length === 0) {
|
|
119
124
|
// pages === 0 is the sentinel for a LOC 400 (out-of-range page request).
|
|
120
125
|
if (pages === 0 && page > 1) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
total: 0,
|
|
124
|
-
page,
|
|
125
|
-
pages: 0,
|
|
126
|
-
has_next: false,
|
|
127
|
-
message: `Page ${page} is out of range for query "${input.query}". Try a smaller page number.`,
|
|
128
|
-
};
|
|
126
|
+
ctx.enrich.notice(`Page ${page} is out of range for query "${input.query}". Try a smaller page number.`);
|
|
127
|
+
return { items: [], total: 0, page, pages: 0, has_next: false };
|
|
129
128
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
(input.format ? ` with format "${input.format}"` : '') +
|
|
138
|
-
(input.date_start || input.date_end
|
|
139
|
-
? ` in dates ${input.date_start ?? ''}–${input.date_end ?? ''}`
|
|
140
|
-
: '') +
|
|
141
|
-
'. Try broadening the query, widening the date range, or running libofcongress_search_subjects to find the exact subject heading.',
|
|
142
|
-
};
|
|
129
|
+
ctx.enrich.notice(`No items matched "${input.query}"` +
|
|
130
|
+
(input.format ? ` with format "${input.format}"` : '') +
|
|
131
|
+
(input.date_start || input.date_end
|
|
132
|
+
? ` in dates ${input.date_start ?? ''}–${input.date_end ?? ''}`
|
|
133
|
+
: '') +
|
|
134
|
+
'. Try broadening the query, widening the date range, or running libofcongress_search_subjects to find the exact subject heading.');
|
|
135
|
+
return { items: [], total: 0, page, pages: 0, has_next: false };
|
|
143
136
|
}
|
|
144
137
|
// Detect contradictory pagination: LOC sometimes returns items on out-of-range pages.
|
|
145
138
|
// Surface a clear message rather than a confusing "Page 999 of 26" display.
|
|
146
139
|
if (pages > 0 && page > pages) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
total,
|
|
150
|
-
page,
|
|
151
|
-
pages,
|
|
152
|
-
has_next: false,
|
|
153
|
-
message: `No results on page ${page} — query has ${pages} page(s) total (${total} items). Use a page number between 1 and ${pages}.`,
|
|
154
|
-
};
|
|
140
|
+
ctx.enrich.notice(`No results on page ${page} — query has ${pages} page(s) total (${total} items). Use a page number between 1 and ${pages}.`);
|
|
141
|
+
return { items: [], total, page, pages, has_next: false };
|
|
155
142
|
}
|
|
156
143
|
return {
|
|
157
144
|
items: result.items,
|
|
@@ -164,8 +151,6 @@ export const locSearch = tool('libofcongress_search', {
|
|
|
164
151
|
format: (result) => {
|
|
165
152
|
const lines = [];
|
|
166
153
|
lines.push(`**Total:** ${result.total} | **Page:** ${result.page} of ${result.pages} | **has_next:** ${result.has_next}`);
|
|
167
|
-
if (result.message)
|
|
168
|
-
lines.push(`\n> ${result.message}`);
|
|
169
154
|
for (const item of result.items) {
|
|
170
155
|
lines.push(`\n## ${item.title}`);
|
|
171
156
|
lines.push(`**ID:** ${item.id}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libofcongress-search.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/libofcongress-search.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,EAAE;IACpD,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EACT,odAAod;IACtd,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IACxD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,kEAAkE,CAAC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KAAK,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC1D,IAAI,IAAI,CAAC,WAAW;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/libofcongress-mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"mcpName": "io.github.cyanheads/libofcongress-mcp-server",
|
|
5
5
|
"description": "Search LOC digital collections, browse Chronicling America newspapers with full OCR text, and look up LC Subject Headings via MCP. STDIO or Streamable HTTP.",
|
|
6
6
|
"type": "module",
|
|
@@ -75,17 +75,17 @@
|
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@cyanheads/mcp-ts-core": "^0.9.
|
|
78
|
+
"@cyanheads/mcp-ts-core": "^0.9.16",
|
|
79
79
|
"pino-pretty": "^13.1.3",
|
|
80
80
|
"zod": "^4.4.3"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@biomejs/biome": "^2.4.
|
|
84
|
-
"@types/node": "^25.
|
|
83
|
+
"@biomejs/biome": "^2.4.16",
|
|
84
|
+
"@types/node": "^25.9.1",
|
|
85
85
|
"depcheck": "^1.4.7",
|
|
86
86
|
"ignore": "^7.0.5",
|
|
87
|
-
"tsc-alias": "^1.8.
|
|
88
|
-
"typescript": "^
|
|
89
|
-
"vitest": "^4.1.
|
|
87
|
+
"tsc-alias": "^1.8.17",
|
|
88
|
+
"typescript": "^6.0.3",
|
|
89
|
+
"vitest": "^4.1.7"
|
|
90
90
|
}
|
|
91
91
|
}
|
package/server.json
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
"url": "https://github.com/cyanheads/libofcongress-mcp-server",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.6",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
14
14
|
"identifier": "@cyanheads/libofcongress-mcp-server",
|
|
15
15
|
"runtimeHint": "bun",
|
|
16
|
-
"version": "0.2.
|
|
16
|
+
"version": "0.2.6",
|
|
17
17
|
"packageArguments": [
|
|
18
18
|
{
|
|
19
19
|
"type": "positional",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"description": "User-Agent header sent with LOC API requests. LOC recommends a descriptive value for polite access.",
|
|
31
31
|
"format": "string",
|
|
32
32
|
"isRequired": false,
|
|
33
|
-
"default": "libofcongress-mcp-server/0.2.
|
|
33
|
+
"default": "libofcongress-mcp-server/0.2.6"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"name": "LOC_REQUEST_DELAY_MS",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
57
57
|
"identifier": "@cyanheads/libofcongress-mcp-server",
|
|
58
58
|
"runtimeHint": "bun",
|
|
59
|
-
"version": "0.2.
|
|
59
|
+
"version": "0.2.6",
|
|
60
60
|
"packageArguments": [
|
|
61
61
|
{
|
|
62
62
|
"type": "positional",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"description": "User-Agent header sent with LOC API requests. LOC recommends a descriptive value for polite access.",
|
|
74
74
|
"format": "string",
|
|
75
75
|
"isRequired": false,
|
|
76
|
-
"default": "libofcongress-mcp-server/0.2.
|
|
76
|
+
"default": "libofcongress-mcp-server/0.2.6"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
"name": "LOC_REQUEST_DELAY_MS",
|
|
Binary file
|