@cyanheads/openalex-mcp-server 0.7.15 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +32 -30
- package/CLAUDE.md +32 -30
- package/Dockerfile +88 -32
- package/README.md +12 -6
- package/changelog/0.7.x/0.7.16.md +32 -0
- package/changelog/0.8.x/0.8.0.md +38 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/prompts/definitions/literature-review.prompt.js +1 -1
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts +4 -3
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.js +62 -19
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts +21 -1
- package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/citation-graph.tool.js +42 -42
- package/dist/mcp-server/tools/definitions/citation-graph.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/describe-fields.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/describe-fields.tool.js +82 -15
- package/dist/mcp-server/tools/definitions/describe-fields.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/resolve-name.tool.js +18 -7
- package/dist/mcp-server/tools/definitions/resolve-name.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts +45 -1
- package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-entities.tool.js +140 -64
- package/dist/mcp-server/tools/definitions/search-entities.tool.js.map +1 -1
- package/dist/mcp-server/tools/escape-markdown.d.ts +32 -0
- package/dist/mcp-server/tools/escape-markdown.d.ts.map +1 -0
- package/dist/mcp-server/tools/escape-markdown.js +389 -0
- package/dist/mcp-server/tools/escape-markdown.js.map +1 -0
- package/dist/mcp-server/tools/render-entity-record.d.ts +14 -2
- package/dist/mcp-server/tools/render-entity-record.d.ts.map +1 -1
- package/dist/mcp-server/tools/render-entity-record.js +46 -15
- package/dist/mcp-server/tools/render-entity-record.js.map +1 -1
- package/dist/mcp-server/tools/response-budget.d.ts +159 -0
- package/dist/mcp-server/tools/response-budget.d.ts.map +1 -0
- package/dist/mcp-server/tools/response-budget.js +480 -0
- package/dist/mcp-server/tools/response-budget.js.map +1 -0
- package/dist/services/openalex/html-entities.json +2237 -0
- package/dist/services/openalex/openalex-service.d.ts +14 -1
- package/dist/services/openalex/openalex-service.d.ts.map +1 -1
- package/dist/services/openalex/openalex-service.js +147 -101
- package/dist/services/openalex/openalex-service.js.map +1 -1
- package/dist/services/openalex/provider-text.d.ts +27 -0
- package/dist/services/openalex/provider-text.d.ts.map +1 -0
- package/dist/services/openalex/provider-text.js +600 -0
- package/dist/services/openalex/provider-text.js.map +1 -0
- package/dist/services/openalex/types.d.ts +6 -1
- package/dist/services/openalex/types.d.ts.map +1 -1
- package/dist/services/openalex/types.js +1 -1
- package/package.json +11 -7
- package/server.json +3 -3
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { renderBudgetTrailer } from '../render-budget.js';
|
|
8
|
-
import {
|
|
9
|
-
import { getOpenAlexService } from '../../../services/openalex/openalex-service.js';
|
|
8
|
+
import { fitRecordsToBudget, fitSliceToBudget, formatRecordPage, joinNotices, measurePageFrame, omittedOutputSchema, overBudgetOutputSchema, windowsOutputSchema, } from '../response-budget.js';
|
|
9
|
+
import { getOpenAlexService, translateSelectField } from '../../../services/openalex/openalex-service.js';
|
|
10
10
|
import { ENTITY_TYPES } from '../../../services/openalex/types.js';
|
|
11
11
|
const SEMANTIC_PER_PAGE_CAP = 50;
|
|
12
12
|
const SAMPLE_MAX = 100;
|
|
13
|
+
/** What `meta.count` counts, in the rendered header. */
|
|
14
|
+
const RESULT_NOUN = 'result(s)';
|
|
13
15
|
/**
|
|
14
16
|
* The parameters that shape a *list* query, each paired with its echo rendering. Ground truth
|
|
15
17
|
* is `OpenAlexService.search()`: its `id` branch requests `/{entity_type}/{id}` with `select`
|
|
@@ -63,7 +65,7 @@ function isContinuationPage(input) {
|
|
|
63
65
|
return input.cursor !== undefined || (input.page ?? 1) > 1;
|
|
64
66
|
}
|
|
65
67
|
export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
66
|
-
description: 'Search, filter, sort, or retrieve by ID. Covers all OpenAlex entity types (works, authors, sources, institutions, topics, keywords, publishers, funders). Pass `id` to retrieve a single entity. Otherwise, use `query` and/or `filters` for discovery. Supports keyword search with boolean operators, exact phrase matching, and AI semantic search. Use openalex_resolve_name to resolve names to IDs before filtering. Searches and ID lookups return a curated set of fields by default; pass `select` to override with specific fields, or `["*"]` for the full record.',
|
|
68
|
+
description: 'Search, filter, sort, or retrieve by ID. Covers all OpenAlex entity types (works, authors, sources, institutions, topics, keywords, publishers, funders). Pass `id` to retrieve a single entity. Otherwise, use `query` and/or `filters` for discovery. Supports keyword search with boolean operators, exact phrase matching, and AI semantic search. Use openalex_resolve_name to resolve names to IDs before filtering. Searches and ID lookups return a curated set of fields by default; pass `select` to override with specific fields, or `["*"]` for the full record. Responses cap at 64,000 bytes per surface unless the least a call can return is larger (`over_budget`); `omitted` and `windows` give the calls that continue a cut, and `slice` pages a long array.',
|
|
67
69
|
sourceUrl: 'https://github.com/cyanheads/openalex-mcp-server/blob/main/src/mcp-server/tools/definitions/search-entities.tool.ts',
|
|
68
70
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
69
71
|
errors: [
|
|
@@ -103,12 +105,36 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
103
105
|
when: 'A search (no `id`) provided both `sample` and `page`.',
|
|
104
106
|
recovery: 'Sampling returns a single page only; remove `page` or remove `sample`.',
|
|
105
107
|
},
|
|
108
|
+
{
|
|
109
|
+
reason: 'sample_with_semantic',
|
|
110
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
111
|
+
when: 'A search (no `id`) provided `sample` with search_mode "semantic", which OpenAlex does not sample — it returns the same ranked candidates under every seed.',
|
|
112
|
+
recovery: 'Switch search_mode to keyword or exact to draw a random sample, or remove `sample` and walk the semantic candidates with `page`.',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
reason: 'sample_with_sort',
|
|
116
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
117
|
+
when: 'A search (no `id`) provided both `sample` and `sort`, which OpenAlex refuses together.',
|
|
118
|
+
recovery: 'A random sample has no order to sort by; remove `sort` or remove `sample`.',
|
|
119
|
+
},
|
|
106
120
|
{
|
|
107
121
|
reason: 'seed_without_sample',
|
|
108
122
|
code: JsonRpcErrorCode.ValidationError,
|
|
109
123
|
when: 'A search (no `id`) provided `seed` without `sample`.',
|
|
110
124
|
recovery: 'Pass `sample` to enable random sampling, or remove `seed`.',
|
|
111
125
|
},
|
|
126
|
+
{
|
|
127
|
+
reason: 'slice_without_id',
|
|
128
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
129
|
+
when: 'A search passed `slice` without `id` — slice pages one array of one record.',
|
|
130
|
+
recovery: "Pass the record's `id` alongside `slice`, or drop `slice` to run the search; a `windows` entry's `next` call carries both.",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
reason: 'slice_field_not_array',
|
|
134
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
135
|
+
when: 'The `slice` field is `*`, or is not an array on the record at `id` — absent, null, a scalar, or an object.',
|
|
136
|
+
recovery: 'Name a top-level array field of that record, such as authorships, referenced_works, or locations; openalex_describe_fields(entity_type, "select") lists the field names.',
|
|
137
|
+
},
|
|
112
138
|
{
|
|
113
139
|
reason: 'entity_not_found',
|
|
114
140
|
code: JsonRpcErrorCode.NotFound,
|
|
@@ -129,7 +155,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
129
155
|
code: JsonRpcErrorCode.RateLimited,
|
|
130
156
|
when: 'The OpenAlex daily usage budget is spent (HTTP 429).',
|
|
131
157
|
retryable: false,
|
|
132
|
-
recovery: '
|
|
158
|
+
recovery: "This server's daily OpenAlex budget is spent and refills at midnight UTC — retrying before then will not succeed.",
|
|
133
159
|
thrownBy: 'service',
|
|
134
160
|
},
|
|
135
161
|
{
|
|
@@ -219,7 +245,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
219
245
|
.string()
|
|
220
246
|
.min(1)
|
|
221
247
|
.optional()
|
|
222
|
-
.describe('Retrieve a single entity by ID. Supports: OpenAlex ID ("W2741809807"), DOI ("10.1038/nature12373"), ORCID ("0000-0002-1825-0097"), ROR ("https://ror.org/00hx57361"), PMID ("12345678" or "https://pubmed.ncbi.nlm.nih.gov/12345678"), ISSN ("1234-5678"). Keywords are identified by slug rather than a native ID — pass either the slug ("groundwater") or the URL a search returns ("https://openalex.org/keywords/groundwater"). A PMCID is recognized too, bare ("PMC1234567") or as a PubMed Central URL, but OpenAlex indexes no PMCIDs, so it resolves nothing — pass the work\'s PMID or DOI instead. When provided, `query`, `search_mode`, `filters`, `sort`, `sample`, and `seed` are not applied — the returned record is the entity at that ID regardless of them, and the response `notice` names any you passed. `select` still applies: the curated per-entity-type default is returned unless you pass `select` (use `["*"]` for the complete record). To filter, drop `id` and search. Use openalex_resolve_name to find the ID if unknown.'),
|
|
248
|
+
.describe('Retrieve a single entity by ID. Supports: OpenAlex ID ("W2741809807"), DOI ("10.1038/nature12373"), ORCID ("0000-0002-1825-0097"), ROR ("https://ror.org/00hx57361"), PMID ("12345678" or "https://pubmed.ncbi.nlm.nih.gov/12345678"), ISSN ("1234-5678"). Keywords are identified by slug rather than a native ID — pass either the slug ("groundwater") or the URL a search returns ("https://openalex.org/keywords/groundwater"). A PMCID is recognized too, bare ("PMC1234567") or as a PubMed Central URL, but OpenAlex indexes no PMCIDs, so it resolves nothing — pass the work\'s PMID or DOI instead. When provided, `query`, `search_mode`, `filters`, `sort`, `sample`, and `seed` are not applied — the returned record is the entity at that ID regardless of them, and the response `notice` names any you passed. `select` still applies: the curated per-entity-type default is returned unless you pass `select` (use `["*"]` for the complete record). An array too long for the response budget comes back as a window (`windows`); page the rest with `slice`. To filter, drop `id` and search. Use openalex_resolve_name to find the ID if unknown.'),
|
|
223
249
|
query: z
|
|
224
250
|
.string()
|
|
225
251
|
.min(1)
|
|
@@ -228,7 +254,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
228
254
|
search_mode: z
|
|
229
255
|
.enum(['keyword', 'exact', 'semantic'])
|
|
230
256
|
.default('keyword')
|
|
231
|
-
.describe(`Search strategy. "keyword": stemmed full-text (default). "exact": no stemming, matches individual words (use quoted phrases for multi-word exact match). "semantic": AI embedding similarity
|
|
257
|
+
.describe(`Search strategy. "keyword": stemmed full-text (default). "exact": no stemming, matches individual words (use quoted phrases for multi-word exact match). "semantic": AI embedding similarity over a query-dependent candidate set whose size \`meta.count\` reports, at ~1 req/sec, up to ${SEMANTIC_PER_PAGE_CAP} per page, and paginated with \`page\` rather than \`cursor\`.`),
|
|
232
258
|
filters: z
|
|
233
259
|
.record(z.string(), z.string())
|
|
234
260
|
.optional()
|
|
@@ -236,18 +262,18 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
236
262
|
sort: z
|
|
237
263
|
.string()
|
|
238
264
|
.optional()
|
|
239
|
-
.describe('Sort field. Prefix with "-" for descending. Comma-separate for a multi-key sort, applied left to right, with the "-" prefix set per key ("-publication_year,cited_by_count" sorts by year descending, then citations ascending). Common: "cited_by_count", "-publication_date", "-relevance_score" (default when query present). Note: when combined with a keyword query, an explicit sort overrides relevance ranking entirely — top results may be highly cited but only tangentially on-topic. Use "-relevance_score" or omit sort to keep the most relevant results first. "-relevance_score" requires an active search via "query" or a "filter:search" filter — passing it without one will fail.'),
|
|
265
|
+
.describe('Sort field. Prefix with "-" for descending. Comma-separate for a multi-key sort, applied left to right, with the "-" prefix set per key ("-publication_year,cited_by_count" sorts by year descending, then citations ascending). Common: "cited_by_count", "-publication_date", "-relevance_score" (default when query present). Note: when combined with a keyword query, an explicit sort overrides relevance ranking entirely — top results may be highly cited but only tangentially on-topic. Use "-relevance_score" or omit sort to keep the most relevant results first. "-relevance_score" requires an active search via "query" or a "filter:search" filter — passing it without one will fail. Not combinable with `sample` — a search passing both is rejected.'),
|
|
240
266
|
select: z
|
|
241
267
|
.array(z.string())
|
|
242
268
|
.optional()
|
|
243
|
-
.describe('OpenAlex top-level field names to return. Always returned: `id`, `display_name` — additional fields you list are appended. A curated default per entity type applies to both searches and single-entity (`id`) lookups; pass field names to override it, or `["*"]` to retrieve the complete record (every field). Only top-level fields project, so a nested value is requested by its parent object: bibliometrics (`h_index`, `i10_index`, `2yr_mean_citedness`) live under `summary_stats` on authors, sources, institutions, publishers, and funders, and naming a leaf returns that object. Invalid field names produce an error identifying the rejected field. Example: ["doi", "authorships", "primary_topic"].'),
|
|
269
|
+
.describe('OpenAlex top-level field names to return. Always returned: `id`, `display_name` — additional fields you list are appended. A curated default per entity type applies to both searches and single-entity (`id`) lookups; pass field names to override it, or `["*"]` to retrieve the complete record (every field). Only top-level fields project, so a nested value is requested by its parent object: bibliometrics (`h_index`, `i10_index`, `2yr_mean_citedness`) live under `summary_stats` on authors, sources, institutions, publishers, and funders, and naming a leaf returns that object. Invalid field names produce an error identifying the rejected field. Large projections may be cut to fit the response budget (`omitted`, `windows`). Not applied with `slice`. Example: ["doi", "authorships", "primary_topic"].'),
|
|
244
270
|
per_page: z
|
|
245
271
|
.number()
|
|
246
272
|
.int()
|
|
247
273
|
.min(1)
|
|
248
274
|
.max(100)
|
|
249
275
|
.default(25)
|
|
250
|
-
.describe('Results per page (1-100). Default 25. Semantic search caps at 50 — when search_mode="semantic", set per_page ≤ 50 (also subject to a 1 req/sec rate limit upstream). The cap applies to searches only; an `id` lookup returns its one record regardless of both.'),
|
|
276
|
+
.describe('Results per page (1-100). Default 25. Semantic search caps at 50 — when search_mode="semantic", set per_page ≤ 50 (also subject to a 1 req/sec rate limit upstream). The cap applies to searches only; an `id` lookup returns its one record regardless of both. A budget-cut page returns fewer (`omitted`).'),
|
|
251
277
|
cursor: z
|
|
252
278
|
.string()
|
|
253
279
|
.min(1)
|
|
@@ -258,46 +284,65 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
258
284
|
.int()
|
|
259
285
|
.min(1)
|
|
260
286
|
.optional()
|
|
261
|
-
.describe(
|
|
287
|
+
.describe('Page number (1-based) for semantic search, the one mode that paginates with `page` instead of `cursor`. Semantic search ranks a query-dependent candidate set whose size `meta.count` reports, so the last reachable page is ceil(meta.count / per_page) — e.g. page 14 for a count of 70 with per_page=5. Passing it under any other search_mode is rejected.'),
|
|
262
288
|
sample: z
|
|
263
289
|
.number()
|
|
264
290
|
.int()
|
|
265
291
|
.min(1)
|
|
266
292
|
.max(SAMPLE_MAX)
|
|
267
293
|
.optional()
|
|
268
|
-
.describe(`Return a random sample of this many entities matching the filters (1-${SAMPLE_MAX}). Single page only — neither \`cursor\` nor \`page\` pagination applies to sampling, and a search that passes either alongside it is rejected. Overrides \`per_page\`. Useful for unbiased exploration: spot-checking filter correctness, stratified review prompts, or generating exploration sets without bias toward most-cited.`),
|
|
294
|
+
.describe(`Return a random sample of this many entities matching the filters (1-${SAMPLE_MAX}). Single page only — neither \`cursor\` nor \`page\` pagination applies to sampling, and a search that passes either alongside it is rejected. Keyword and exact modes only: OpenAlex does not sample a semantic search, so \`sample\` with search_mode "semantic" is rejected. Cannot be combined with \`sort\` — a sample has no order, and a search passing both is rejected. Overrides \`per_page\`. Useful for unbiased exploration: spot-checking filter correctness, stratified review prompts, or generating exploration sets without bias toward most-cited.`),
|
|
269
295
|
seed: z
|
|
270
296
|
.string()
|
|
271
297
|
.optional()
|
|
272
298
|
.describe('Deterministic seed for `sample`. Same seed + same filters = same results — pass when reproducibility matters. Has no effect without `sample`, and a search that passes it alone is rejected.'),
|
|
299
|
+
slice: z
|
|
300
|
+
.object({
|
|
301
|
+
field: z
|
|
302
|
+
.string()
|
|
303
|
+
.describe('Top-level array field to page, such as "authorships" or "referenced_works". Leave it empty to skip slicing.'),
|
|
304
|
+
offset: z
|
|
305
|
+
.number()
|
|
306
|
+
.int()
|
|
307
|
+
.min(0)
|
|
308
|
+
.default(0)
|
|
309
|
+
.describe('0-based index of the first element to return.'),
|
|
310
|
+
})
|
|
311
|
+
.optional()
|
|
312
|
+
.describe('Page one array of the record at `id`: returns `id`, `display_name`, and `field` from `offset` onward, as many elements as fit the response budget (at least one), with the window and its `next` call in `windows`. Requires `id`; replaces `select`. An offset at or past the end returns an empty window. Walks any partial array, including a possibly capped 100-authorship list.'),
|
|
273
313
|
}),
|
|
274
314
|
output: z.object({
|
|
275
315
|
meta: z
|
|
276
316
|
.object({
|
|
277
317
|
count: z
|
|
278
318
|
.number()
|
|
279
|
-
.describe(
|
|
319
|
+
.describe('Total results matching the query/filters. Under search_mode "semantic" it is instead the size of the ranked candidate set — the most results `page` can reach — not an exhaustive match total.'),
|
|
280
320
|
per_page: z
|
|
281
321
|
.number()
|
|
282
|
-
.describe('Page size OpenAlex echoed for this request — the requested per_page, not the number of records returned. A short or exhausted page carries fewer records than this.'),
|
|
322
|
+
.describe('Page size OpenAlex echoed for this request — the requested per_page, not the number of records returned. A short or exhausted page carries fewer records than this, as does a page the response budget cut (`omitted`).'),
|
|
283
323
|
next_cursor: z
|
|
284
324
|
.string()
|
|
285
325
|
.nullable()
|
|
286
|
-
.describe('Cursor for next page. null if no more results.'),
|
|
326
|
+
.describe('Cursor for next page. null if no more results. Continues after the full upstream page, `omitted` records included.'),
|
|
287
327
|
})
|
|
288
328
|
.describe('Result metadata including pagination.'),
|
|
289
329
|
results: z
|
|
290
330
|
.array(z
|
|
291
331
|
.object({
|
|
292
|
-
id: z
|
|
332
|
+
id: z
|
|
333
|
+
.string()
|
|
334
|
+
.describe('OpenAlex ID URL (e.g., "https://openalex.org/W2741809807"). `windows` and `omitted` name records by the bare ID ("W2741809807"); a keyword keeps its URL.'),
|
|
293
335
|
display_name: z
|
|
294
336
|
.string()
|
|
295
337
|
.nullable()
|
|
296
338
|
.describe('Entity name or work title. null when OpenAlex holds no title for the record (paratext works and other untitled entries) — use `id` to identify it.'),
|
|
297
339
|
})
|
|
298
|
-
.
|
|
340
|
+
.loose()
|
|
299
341
|
.describe('A single OpenAlex entity record. `id` is always present and `display_name` is always returned (though it may be null); additional fields vary by entity_type and `select`.'))
|
|
300
|
-
.describe('OpenAlex entity objects
|
|
342
|
+
.describe('OpenAlex entity objects. Text values are plain text — HTML entities decoded, HTML/JATS/MathML markup removed — except identifier and URL fields such as `id`, `doi`, `ids`, and `*_url`, returned exactly as OpenAlex stores them; an abstract arrives reconstructed as `abstract`. Additional fields depend on entity_type and select. Records cut by the response budget are in `omitted`; partial or possibly capped arrays are in `windows`.'),
|
|
343
|
+
omitted: omittedOutputSchema,
|
|
344
|
+
windows: windowsOutputSchema,
|
|
345
|
+
over_budget: overBudgetOutputSchema,
|
|
301
346
|
}),
|
|
302
347
|
// Agent-facing context for the success path — the query/filters as parsed, the
|
|
303
348
|
// total match count, and recovery guidance for empty results. Populated via
|
|
@@ -310,7 +355,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
310
355
|
notice: z
|
|
311
356
|
.string()
|
|
312
357
|
.optional()
|
|
313
|
-
.describe('Guidance notice. Set when a first call returns no results (echoes the criteria and suggests how to broaden), when a paginated call ran past its last page (says the traversal is finished instead of advising a broader query), when an `id` lookup was passed search criteria it does not apply (names them),
|
|
358
|
+
.describe('Guidance notice. Set when a first call returns no results (echoes the criteria and suggests how to broaden), when a paginated call ran past its last page (says the traversal is finished instead of advising a broader query), when an `id` lookup was passed search criteria it does not apply (names them), on every semantic search to disclose that `meta.count` is a candidate total rather than a match total, when the response budget cut records, windowed an array, or ran over, when a list record carries exactly 100 authorships (possibly capped), when a `slice` offset is past the end of its array, and when `slice` was passed with `select`, which it replaces. Absent otherwise.'),
|
|
314
359
|
budget: z
|
|
315
360
|
.object({
|
|
316
361
|
costUsd: z
|
|
@@ -334,6 +379,15 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
334
379
|
budget: { render: renderBudgetTrailer },
|
|
335
380
|
},
|
|
336
381
|
async handler(input, ctx) {
|
|
382
|
+
// A form client sends an empty `slice.field` for an unset slice; an empty field is no slice.
|
|
383
|
+
const slice = input.slice?.field ? input.slice : undefined;
|
|
384
|
+
if (slice && !input.id) {
|
|
385
|
+
throw ctx.fail('slice_without_id', '`slice` pages one array of the record at `id`, and no `id` was supplied.', { slice });
|
|
386
|
+
}
|
|
387
|
+
// `*` would fetch the full record only to find no field of that name; refuse it up front.
|
|
388
|
+
if (slice?.field === '*') {
|
|
389
|
+
throw ctx.fail('slice_field_not_array', '`slice.field` is `*`, which names every field rather than one array.', { field: slice.field, id: input.id });
|
|
390
|
+
}
|
|
337
391
|
/**
|
|
338
392
|
* Reject list-query parameter combinations OpenAlex cannot serve. Every check here
|
|
339
393
|
* constrains a *list* query. `id` takes the singleton path in `OpenAlexService.search()`,
|
|
@@ -347,45 +401,44 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
347
401
|
// nothing to embed — the request silently degraded to a plain unfiltered listing whose
|
|
348
402
|
// echo still advertised `search_mode=semantic`.
|
|
349
403
|
if (input.search_mode === 'semantic' && !input.query) {
|
|
350
|
-
throw ctx.fail('semantic_without_query', 'Semantic search needs `query` text to embed — none was supplied.', {
|
|
404
|
+
throw ctx.fail('semantic_without_query', 'Semantic search needs `query` text to embed — none was supplied.', { searchMode: input.search_mode });
|
|
351
405
|
}
|
|
352
406
|
if (input.search_mode === 'semantic' && input.per_page > SEMANTIC_PER_PAGE_CAP) {
|
|
353
|
-
throw ctx.fail('semantic_per_page_cap', `Semantic search supports at most ${SEMANTIC_PER_PAGE_CAP} results per page. Reduce per_page or switch search_mode.`, {
|
|
354
|
-
...ctx.recoveryFor('semantic_per_page_cap'),
|
|
355
|
-
searchMode: input.search_mode,
|
|
356
|
-
perPage: input.per_page,
|
|
357
|
-
cap: SEMANTIC_PER_PAGE_CAP,
|
|
358
|
-
});
|
|
407
|
+
throw ctx.fail('semantic_per_page_cap', `Semantic search supports at most ${SEMANTIC_PER_PAGE_CAP} results per page. Reduce per_page or switch search_mode.`, { searchMode: input.search_mode, perPage: input.per_page, cap: SEMANTIC_PER_PAGE_CAP });
|
|
359
408
|
}
|
|
360
409
|
// OpenAlex answers `search.semantic` plus a cursor with a 400 ("Cursor pagination is not
|
|
361
410
|
// supported with semantic search"), so forwarding it spends a round trip to learn that.
|
|
362
411
|
if (input.search_mode === 'semantic' && input.cursor !== undefined) {
|
|
363
|
-
throw ctx.fail('semantic_with_cursor', 'Semantic search does not accept `cursor` — walk its candidates with `page` (1-based) instead.', {
|
|
364
|
-
...ctx.recoveryFor('semantic_with_cursor'),
|
|
365
|
-
searchMode: input.search_mode,
|
|
366
|
-
cursor: input.cursor,
|
|
367
|
-
});
|
|
412
|
+
throw ctx.fail('semantic_with_cursor', 'Semantic search does not accept `cursor` — walk its candidates with `page` (1-based) instead.', { searchMode: input.search_mode, cursor: input.cursor });
|
|
368
413
|
}
|
|
369
414
|
// The inverse: `page` is the semantic-only knob, and OpenAlex ignores it on a cursor
|
|
370
415
|
// traversal — silently returning page 1 again rather than the page that was asked for.
|
|
371
416
|
if (input.page !== undefined && input.search_mode !== 'semantic') {
|
|
372
|
-
throw ctx.fail('page_without_semantic', `\`page\` applies to semantic search only — search_mode is "${input.search_mode}", which paginates with \`cursor\`.`, {
|
|
373
|
-
...ctx.recoveryFor('page_without_semantic'),
|
|
374
|
-
searchMode: input.search_mode,
|
|
375
|
-
page: input.page,
|
|
376
|
-
});
|
|
417
|
+
throw ctx.fail('page_without_semantic', `\`page\` applies to semantic search only — search_mode is "${input.search_mode}", which paginates with \`cursor\`.`, { searchMode: input.search_mode, page: input.page });
|
|
377
418
|
}
|
|
378
419
|
if (input.sample !== undefined && input.cursor !== undefined) {
|
|
379
|
-
throw ctx.fail('sample_with_cursor', 'Sampling returns one page only — `sample` cannot be combined with `cursor` pagination.', {
|
|
420
|
+
throw ctx.fail('sample_with_cursor', 'Sampling returns one page only — `sample` cannot be combined with `cursor` pagination.', { sample: input.sample, cursor: input.cursor });
|
|
380
421
|
}
|
|
381
422
|
// Sampling pins `per_page` to `sample` and returns that one page, so there is no second
|
|
382
423
|
// page for `page` to address — the same exclusion `cursor` has above. Reachable under
|
|
383
424
|
// semantic mode alone; every other mode rejects `page` at the check before this one.
|
|
384
425
|
if (input.sample !== undefined && input.page !== undefined) {
|
|
385
|
-
throw ctx.fail('sample_with_page', 'Sampling returns one page only — `sample` cannot be combined with `page` pagination.', {
|
|
426
|
+
throw ctx.fail('sample_with_page', 'Sampling returns one page only — `sample` cannot be combined with `page` pagination.', { sample: input.sample, page: input.page });
|
|
427
|
+
}
|
|
428
|
+
// OpenAlex ignores `sample` and `seed` under `search.semantic` and returns the ranked page,
|
|
429
|
+
// so forwarding the pair would label a relevance ranking as a random sample. The population
|
|
430
|
+
// request would also carry `cursor=*` beside `search.semantic`, which upstream rejects.
|
|
431
|
+
// Checked after `sample_with_page`, which is reachable under semantic mode alone.
|
|
432
|
+
if (input.sample !== undefined && input.search_mode === 'semantic') {
|
|
433
|
+
throw ctx.fail('sample_with_semantic', 'Semantic search does not sample — OpenAlex returns the same ranked candidates under every seed.', { sample: input.sample, searchMode: input.search_mode });
|
|
434
|
+
}
|
|
435
|
+
// OpenAlex answers any sort beside `sample` with a 400 ("sample does not work with sort").
|
|
436
|
+
// A blank or whitespace-only sort is never sent upstream, so it is no conflict.
|
|
437
|
+
if (input.sample !== undefined && input.sort?.trim()) {
|
|
438
|
+
throw ctx.fail('sample_with_sort', 'A random sample cannot be sorted — `sample` cannot be combined with `sort`.', { sample: input.sample, sort: input.sort });
|
|
386
439
|
}
|
|
387
440
|
if (input.seed !== undefined && input.sample === undefined) {
|
|
388
|
-
throw ctx.fail('seed_without_sample', '`seed` is only meaningful with `sample` — pass `sample` to enable random sampling.', {
|
|
441
|
+
throw ctx.fail('seed_without_sample', '`seed` is only meaningful with `sample` — pass `sample` to enable random sampling.', { seed: input.seed });
|
|
389
442
|
}
|
|
390
443
|
}
|
|
391
444
|
const service = getOpenAlexService();
|
|
@@ -396,7 +449,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
396
449
|
searchMode: input.search_mode,
|
|
397
450
|
filters: input.filters,
|
|
398
451
|
sort: input.sort,
|
|
399
|
-
select: input.select,
|
|
452
|
+
select: slice ? [slice.field] : input.select,
|
|
400
453
|
perPage: input.per_page,
|
|
401
454
|
cursor: input.cursor,
|
|
402
455
|
page: input.page,
|
|
@@ -427,36 +480,59 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
427
480
|
: `No matches for ${echo}. Try broadening the query, removing filters, or switching search_mode.`);
|
|
428
481
|
}
|
|
429
482
|
// `meta.count` reports the ranked candidate set under semantic search, not the population
|
|
430
|
-
// matching the query
|
|
431
|
-
//
|
|
483
|
+
// matching the query. Its size is query-dependent (OpenAlex serves 70 for some queries,
|
|
484
|
+
// 50 for others), so the notice states the count it got rather than a fixed ceiling.
|
|
432
485
|
if (!input.id && input.search_mode === 'semantic') {
|
|
433
|
-
notices.push(`Semantic search ranks a
|
|
486
|
+
notices.push(`Semantic search ranks a candidate set rather than every match, so \`meta.count\` (${result.meta.count}) is the number of candidates \`page\` can reach, not the total number of matching records. Reach the rest of the candidates with \`page\`.`);
|
|
487
|
+
}
|
|
488
|
+
if (slice && input.select) {
|
|
489
|
+
notices.push('`slice` returns only `id`, `display_name`, and the sliced field, so `select` was not applied.');
|
|
434
490
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
count: result.meta.count,
|
|
440
|
-
per_page: result.meta.per_page,
|
|
441
|
-
next_cursor: result.meta.next_cursor,
|
|
442
|
-
},
|
|
443
|
-
results: result.results,
|
|
491
|
+
const meta = {
|
|
492
|
+
count: result.meta.count,
|
|
493
|
+
per_page: result.meta.per_page,
|
|
494
|
+
next_cursor: result.meta.next_cursor,
|
|
444
495
|
};
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
496
|
+
const measureFrame = (disclosure, budgetNotice) => measurePageFrame({ meta, results: [], ...disclosure }, RESULT_NOUN, {
|
|
497
|
+
echo,
|
|
498
|
+
totalCount: result.meta.count,
|
|
499
|
+
totalLabel: 'Total',
|
|
500
|
+
notice: joinNotices([...notices, budgetNotice]),
|
|
501
|
+
});
|
|
502
|
+
let page;
|
|
503
|
+
if (slice) {
|
|
504
|
+
// The one-field projection lands under the canonical key — `authors` arrives as `authorships`.
|
|
505
|
+
const field = translateSelectField(input.entity_type, slice.field);
|
|
506
|
+
const [record] = result.results;
|
|
507
|
+
const items = record?.[field];
|
|
508
|
+
if (!record || !Array.isArray(items)) {
|
|
509
|
+
throw ctx.fail('slice_field_not_array', `\`${slice.field}\` is not an array on the record at ${input.id}.`, { field: slice.field, id: input.id });
|
|
510
|
+
}
|
|
511
|
+
if (slice.offset > items.length) {
|
|
512
|
+
notices.push(`slice.offset ${slice.offset} is past the end of \`${field}\`, which holds ${items.length} element(s), so nothing follows.`);
|
|
513
|
+
}
|
|
514
|
+
page = fitSliceToBudget({
|
|
515
|
+
record,
|
|
516
|
+
field,
|
|
517
|
+
offset: slice.offset,
|
|
518
|
+
entityType: input.entity_type,
|
|
519
|
+
measureFrame,
|
|
520
|
+
});
|
|
455
521
|
}
|
|
456
|
-
|
|
457
|
-
|
|
522
|
+
else {
|
|
523
|
+
page = fitRecordsToBudget({
|
|
524
|
+
records: result.results,
|
|
525
|
+
entityType: input.entity_type,
|
|
526
|
+
path: input.id ? 'lookup' : 'list',
|
|
527
|
+
select: input.select,
|
|
528
|
+
measureFrame,
|
|
529
|
+
});
|
|
458
530
|
}
|
|
459
|
-
|
|
531
|
+
const notice = joinNotices([...notices, page.notice]);
|
|
532
|
+
if (notice)
|
|
533
|
+
ctx.enrich.notice(notice);
|
|
534
|
+
return { meta, results: page.results, ...page.disclosure };
|
|
460
535
|
},
|
|
536
|
+
format: (result) => formatRecordPage(result, RESULT_NOUN),
|
|
461
537
|
});
|
|
462
538
|
//# sourceMappingURL=search-entities.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-entities.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-entities.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,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAqB,MAAM,8BAA8B,CAAC;AAE/E,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,UAAU,GAAG,GAAG,CAAC;AAavB;;;;;;;;;GASG;AACH,SAAS,gBAAgB,CAAC,KAAsB;IAC9C,MAAM,KAAK,GAAyC,EAAE,CAAC;IACvD,IAAI,KAAK,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;IACnF,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,C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CAAC,QAAQ,WAAW,CAAC;QACvF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW;YACpC,CAAC,CAAC,KAAK,UAAU,uBAAuB,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI;YACnE,CAAC,CAAC,KAAK,UAAU,IAAI,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEnB,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpD,CAAC;QAED,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,MAAsB,CAAC,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"search-entities.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-entities.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,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAGL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CA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O,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAC7D,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC;CAC1D,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Markdown escaping for provider text at the `content[]` boundary. Every `format()`
|
|
3
|
+
* that interpolates OpenAlex text routes it through `escapeMarkdown`, so the surfaces cannot
|
|
4
|
+
* drift. Escapes use backslashes, never HTML entities, and cover only what a CommonMark + GFM
|
|
5
|
+
* renderer would read as structure; a URL that GFM links cleanly renders byte-identical, as the
|
|
6
|
+
* autolink it is. `structuredContent` never passes through here — it carries the plain text.
|
|
7
|
+
* @module mcp-server/tools/escape-markdown
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Where the text lands. `inline` is mid-line (after a label, inside bold, in a list item);
|
|
11
|
+
* `line-start` begins a line, where block syntax (`#`, `- `, `1. `, `>`, `[label]:`) applies;
|
|
12
|
+
* `heading` follows `### `, where a trailing `#` run would close the heading.
|
|
13
|
+
*/
|
|
14
|
+
export type MarkdownPosition = 'inline' | 'line-start' | 'heading';
|
|
15
|
+
/**
|
|
16
|
+
* Escape provider text for Markdown so a renderer shows exactly the characters it holds.
|
|
17
|
+
*
|
|
18
|
+
* Escaped everywhere: `*`, backticks, `~` (GFM strikethrough), `<` before a letter, `/`, `!`, or
|
|
19
|
+
* `?`, `_` unless it sits between two letters or digits, `&` when it starts a character reference
|
|
20
|
+
* a renderer would decode, a backslash before punctuation or at the end, a `<` that opens an
|
|
21
|
+
* email autolink, and any `[` ahead of a `](` pair (a link needs it to open its label) or never
|
|
22
|
+
* closed. Closed citation brackets with no `](` after them stay as they are. At a line start,
|
|
23
|
+
* also the block markers; in a heading, a trailing `#` run. Line breaks and tabs collapse to a
|
|
24
|
+
* space.
|
|
25
|
+
*
|
|
26
|
+
* A span GFM links as an autolink literal passes through untouched. When it cannot — trailing
|
|
27
|
+
* punctuation that needs an escape would join the link, an open `[` or an email literal holds
|
|
28
|
+
* it, or GFM would not link it at all — the `:` or `.` of its prefix is escaped instead, which
|
|
29
|
+
* reads the same but links nothing in any renderer, and the span is escaped like any other text.
|
|
30
|
+
*/
|
|
31
|
+
export declare function escapeMarkdown(text: string, position?: MarkdownPosition): string;
|
|
32
|
+
//# sourceMappingURL=escape-markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape-markdown.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/escape-markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC;AAoQnE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,gBAA2B,GAAG,MAAM,CA4F1F"}
|