@cyanheads/openalex-mcp-server 0.8.0 → 0.10.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.
Files changed (67) hide show
  1. package/AGENTS.md +25 -7
  2. package/CLAUDE.md +25 -7
  3. package/Dockerfile +17 -8
  4. package/README.md +28 -19
  5. package/changelog/0.10.x/0.10.0.md +30 -0
  6. package/changelog/0.9.x/0.9.0.md +48 -0
  7. package/dist/config/server-config.d.ts +2 -0
  8. package/dist/config/server-config.d.ts.map +1 -1
  9. package/dist/config/server-config.js +10 -0
  10. package/dist/config/server-config.js.map +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/mcp-server/prompts/definitions/literature-review.prompt.js +1 -1
  14. package/dist/mcp-server/prompts/definitions/research-landscape.prompt.js +1 -1
  15. package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts +35 -4
  16. package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts.map +1 -1
  17. package/dist/mcp-server/tools/definitions/analyze-trends.tool.js +86 -41
  18. package/dist/mcp-server/tools/definitions/analyze-trends.tool.js.map +1 -1
  19. package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts +48 -5
  20. package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts.map +1 -1
  21. package/dist/mcp-server/tools/definitions/citation-graph.tool.js +77 -24
  22. package/dist/mcp-server/tools/definitions/citation-graph.tool.js.map +1 -1
  23. package/dist/mcp-server/tools/definitions/describe-fields.tool.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/definitions/describe-fields.tool.js +34 -4
  25. package/dist/mcp-server/tools/definitions/describe-fields.tool.js.map +1 -1
  26. package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts +43 -1
  27. package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts.map +1 -1
  28. package/dist/mcp-server/tools/definitions/resolve-name.tool.js +182 -40
  29. package/dist/mcp-server/tools/definitions/resolve-name.tool.js.map +1 -1
  30. package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts +64 -6
  31. package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts.map +1 -1
  32. package/dist/mcp-server/tools/definitions/search-entities.tool.js +138 -35
  33. package/dist/mcp-server/tools/definitions/search-entities.tool.js.map +1 -1
  34. package/dist/mcp-server/tools/page-size.d.ts +18 -0
  35. package/dist/mcp-server/tools/page-size.d.ts.map +1 -0
  36. package/dist/mcp-server/tools/page-size.js +28 -0
  37. package/dist/mcp-server/tools/page-size.js.map +1 -0
  38. package/dist/mcp-server/tools/render-budget.d.ts +4 -2
  39. package/dist/mcp-server/tools/render-budget.d.ts.map +1 -1
  40. package/dist/mcp-server/tools/render-budget.js +4 -2
  41. package/dist/mcp-server/tools/render-budget.js.map +1 -1
  42. package/dist/mcp-server/tools/response-budget.d.ts +3 -3
  43. package/dist/mcp-server/tools/response-budget.d.ts.map +1 -1
  44. package/dist/mcp-server/tools/response-budget.js +64 -35
  45. package/dist/mcp-server/tools/response-budget.js.map +1 -1
  46. package/dist/services/openalex/budget.d.ts +3 -1
  47. package/dist/services/openalex/budget.d.ts.map +1 -1
  48. package/dist/services/openalex/budget.js +3 -1
  49. package/dist/services/openalex/budget.js.map +1 -1
  50. package/dist/services/openalex/field-catalog.json +50 -1
  51. package/dist/services/openalex/filter-values.d.ts +48 -0
  52. package/dist/services/openalex/filter-values.d.ts.map +1 -0
  53. package/dist/services/openalex/filter-values.js +350 -0
  54. package/dist/services/openalex/filter-values.js.map +1 -0
  55. package/dist/services/openalex/iso-codes.json +1565 -0
  56. package/dist/services/openalex/openalex-service.d.ts +176 -20
  57. package/dist/services/openalex/openalex-service.d.ts.map +1 -1
  58. package/dist/services/openalex/openalex-service.js +573 -127
  59. package/dist/services/openalex/openalex-service.js.map +1 -1
  60. package/dist/services/openalex/provider-text.d.ts +7 -6
  61. package/dist/services/openalex/provider-text.d.ts.map +1 -1
  62. package/dist/services/openalex/provider-text.js +485 -61
  63. package/dist/services/openalex/provider-text.js.map +1 -1
  64. package/dist/services/openalex/types.d.ts +5 -2
  65. package/dist/services/openalex/types.d.ts.map +1 -1
  66. package/package.json +14 -12
  67. package/server.json +35 -21
@@ -4,14 +4,40 @@
4
4
  */
5
5
  import { tool, z } from '@cyanheads/mcp-ts-core';
6
6
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ import { ATTR_MCP_TOOL_NAME, createCounter } from '@cyanheads/mcp-ts-core/utils';
8
+ import { getServerConfig } from '../../../config/server-config.js';
9
+ import { clampPageSize, pageSizeSchema } from '../page-size.js';
7
10
  import { renderBudgetTrailer } from '../render-budget.js';
8
11
  import { fitRecordsToBudget, fitSliceToBudget, formatRecordPage, joinNotices, measurePageFrame, omittedOutputSchema, overBudgetOutputSchema, windowsOutputSchema, } from '../response-budget.js';
9
- import { getOpenAlexService, translateSelectField } from '../../../services/openalex/openalex-service.js';
12
+ import { parseNativeFilters, quoteCallerText } from '../../../services/openalex/filter-values.js';
13
+ import { getOpenAlexService, selectRecordKey } from '../../../services/openalex/openalex-service.js';
10
14
  import { ENTITY_TYPES } from '../../../services/openalex/types.js';
11
15
  const SEMANTIC_PER_PAGE_CAP = 50;
12
16
  const SAMPLE_MAX = 100;
13
17
  /** What `meta.count` counts, in the rendered header. */
14
18
  const RESULT_NOUN = 'result(s)';
19
+ const canonicalFilters = z.record(z.string(), z.string());
20
+ const { $schema: _schema, ...filterProjection } = z.toJSONSchema(canonicalFilters, { io: 'input' });
21
+ /** Provenance belongs to the parsed call; only the canonical record is sent to the service. */
22
+ const normalizedFilters = z
23
+ .preprocess((raw, ctx) => {
24
+ /**
25
+ * Leave JSON-object representations to the framework's existing record repair. Report
26
+ * canonical paths so repairs target caller fields rather than the internal wrapper.
27
+ */
28
+ const converted = typeof raw === 'string' &&
29
+ !raw.trimStart().startsWith('{') &&
30
+ getServerConfig().filterStringInput;
31
+ const parsed = canonicalFilters.safeParse(converted ? parseNativeFilters(raw) : raw);
32
+ if (!parsed.success) {
33
+ for (const issue of parsed.error.issues)
34
+ ctx.addIssue({ ...issue });
35
+ return z.NEVER;
36
+ }
37
+ return { value: parsed.data, converted };
38
+ }, z.object({ value: canonicalFilters, converted: z.boolean() }))
39
+ .meta({ ...filterProjection, properties: undefined, required: undefined });
40
+ const filterStringConversions = createCounter('openalex.filter_string.conversions', 'Native filter strings converted to records', '{conversion}');
15
41
  /**
16
42
  * The parameters that shape a *list* query, each paired with its echo rendering. Ground truth
17
43
  * is `OpenAlexService.search()`: its `id` branch requests `/{entity_type}/{id}` with `select`
@@ -25,7 +51,7 @@ const RESULT_NOUN = 'result(s)';
25
51
  function searchOnlyParams(input) {
26
52
  const parts = [];
27
53
  if (input.query)
28
- parts.push({ name: 'query', rendered: `query="${input.query}"` });
54
+ parts.push({ name: 'query', rendered: `query=${JSON.stringify(input.query)}` });
29
55
  if (input.search_mode && input.search_mode !== 'keyword') {
30
56
  parts.push({ name: 'search_mode', rendered: `search_mode=${input.search_mode}` });
31
57
  }
@@ -33,23 +59,25 @@ function searchOnlyParams(input) {
33
59
  parts.push({ name: 'filters', rendered: `filters=${JSON.stringify(input.filters)}` });
34
60
  }
35
61
  if (input.sort)
36
- parts.push({ name: 'sort', rendered: `sort=${input.sort}` });
62
+ parts.push({ name: 'sort', rendered: `sort=${JSON.stringify(input.sort)}` });
37
63
  if (input.sample !== undefined) {
38
64
  parts.push({ name: 'sample', rendered: `sample=${input.sample}` });
39
65
  }
40
- if (input.seed !== undefined)
41
- parts.push({ name: 'seed', rendered: `seed=${input.seed}` });
66
+ if (input.seed !== undefined) {
67
+ parts.push({ name: 'seed', rendered: `seed=${JSON.stringify(input.seed)}` });
68
+ }
42
69
  return parts;
43
70
  }
44
71
  /**
45
72
  * Echo the criteria that actually ran. An `id` lookup echoes `entity_type` and `id` only —
46
73
  * echoing a filter the singleton path never applied reads as confirmation that it did, which
47
- * is the one thing this field exists not to do.
74
+ * is the one thing this field exists not to do. Caller text is JSON-encoded, so a line break in
75
+ * it cannot start a heading or end the line the echo renders on.
48
76
  */
49
77
  function buildSearchEcho(input) {
50
78
  const parts = [`entity_type=${input.entity_type}`];
51
79
  if (input.id)
52
- return [...parts, `id=${input.id}`].join(' | ');
80
+ return [...parts, `id=${JSON.stringify(input.id)}`].join(' | ');
53
81
  return [...parts, ...searchOnlyParams(input).map((part) => part.rendered)].join(' | ');
54
82
  }
55
83
  /**
@@ -65,10 +93,31 @@ function isContinuationPage(input) {
65
93
  return input.cursor !== undefined || (input.page ?? 1) > 1;
66
94
  }
67
95
  export const searchEntitiesTool = tool('openalex_search_entities', {
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.',
96
+ 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. Filters take a record object; an unambiguous native string such as "issn:0920-8542" is also accepted when enabled and disclosed in `notice`. Native clauses split on commas outside paired double quotes and the first colon; duplicate keys and bare fragments are rejected. Any filter value sent unquoted must have paired double quotes; balanced search phrases remain valid. 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.',
69
97
  sourceUrl: 'https://github.com/cyanheads/openalex-mcp-server/blob/main/src/mcp-server/tools/definitions/search-entities.tool.ts',
70
98
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
71
99
  errors: [
100
+ {
101
+ reason: 'invalid_filter_string',
102
+ code: JsonRpcErrorCode.ValidationError,
103
+ when: 'A native filter string has an incomplete clause or unmatched double quotes.',
104
+ recovery: 'Pass filters as a record object with one key per field, and pair any double quotes in search phrases.',
105
+ thrownBy: 'service',
106
+ },
107
+ {
108
+ reason: 'duplicate_filter_string_key',
109
+ code: JsonRpcErrorCode.ValidationError,
110
+ when: 'A native filter string repeats an exact key.',
111
+ recovery: 'A filters record object holds one key per field; combine alternatives with "|", or run separate calls.',
112
+ thrownBy: 'service',
113
+ },
114
+ {
115
+ reason: 'unmatched_quote_in_filter_value',
116
+ code: JsonRpcErrorCode.ValidationError,
117
+ when: 'A filter value sent unquoted has an unmatched double quote.',
118
+ recovery: 'Pair double quotes used for a search phrase, or remove the stray quote.',
119
+ thrownBy: 'service',
120
+ },
72
121
  {
73
122
  reason: 'semantic_per_page_cap',
74
123
  code: JsonRpcErrorCode.ValidationError,
@@ -133,7 +182,21 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
133
182
  reason: 'slice_field_not_array',
134
183
  code: JsonRpcErrorCode.ValidationError,
135
184
  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.',
185
+ recovery: 'Name a top-level array field of that record, such as authorships, author_list, referenced_works, or locations; openalex_describe_fields(entity_type, "select") lists the field names.',
186
+ },
187
+ {
188
+ reason: 'id_type_mismatch',
189
+ code: JsonRpcErrorCode.ValidationError,
190
+ when: '`id` is a native OpenAlex ID whose letter names another entity type than `entity_type`, or a concept ID (C…), a type this server does not serve.',
191
+ recovery: 'Pass the entity_type the ID letter names — W works, A authors, S sources, I institutions, T topics, P publishers, F funders. A concept ID (C…) has no entity_type here; search topics for the concept by name with openalex_resolve_name instead.',
192
+ thrownBy: 'service',
193
+ },
194
+ {
195
+ reason: 'id_dot_segment',
196
+ code: JsonRpcErrorCode.ValidationError,
197
+ when: '`id` holds a `.` or `..` path segment, written plainly or percent-encoded.',
198
+ recovery: 'Pass the identifier itself — an OpenAlex ID, DOI, ORCID, ROR, PMID, or ISSN — with no relative path segments, or drop `id` and search with `query` or `filters`.',
199
+ thrownBy: 'service',
137
200
  },
138
201
  {
139
202
  reason: 'entity_not_found',
@@ -158,6 +221,14 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
158
221
  recovery: "This server's daily OpenAlex budget is spent and refills at midnight UTC — retrying before then will not succeed.",
159
222
  thrownBy: 'service',
160
223
  },
224
+ {
225
+ reason: 'upstream_plan_required',
226
+ code: JsonRpcErrorCode.Forbidden,
227
+ when: 'A filter is one OpenAlex serves only on a paid plan — created_date, updated_date, or a from_/to_ form of either (HTTP 429 "Plan upgrade required").',
228
+ retryable: false,
229
+ recovery: 'Drop the plan-gated filter and rerun; retrying it unchanged will not succeed. To bound works by date, filter on publication_date, from_publication_date, or to_publication_date, which need no paid plan.',
230
+ thrownBy: 'service',
231
+ },
161
232
  {
162
233
  reason: 'upstream_timeout',
163
234
  code: JsonRpcErrorCode.Timeout,
@@ -169,7 +240,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
169
240
  {
170
241
  reason: 'upstream_unavailable',
171
242
  code: JsonRpcErrorCode.ServiceUnavailable,
172
- when: 'OpenAlex was unreachable or unusable — HTTP 503, a connection failure, or a body that was empty, HTML, or unparseable JSON.',
243
+ when: 'OpenAlex was unreachable or unusable — HTTP 503, a connection failure, a body that was empty, HTML, or unparseable JSON, or a semantic search whose query embedding failed upstream (HTTP 400 `Failed to embed query:`, or semantic search not configured).',
173
244
  retryable: true,
174
245
  recovery: 'Wait and retry; check https://openalex.org for service status if the outage persists.',
175
246
  thrownBy: 'service',
@@ -191,8 +262,29 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
191
262
  {
192
263
  reason: 'comma_in_filter_value',
193
264
  code: JsonRpcErrorCode.InvalidParams,
194
- when: 'A filter value contains a comma, which collides with the OpenAlex filter separator.',
195
- recovery: 'Use `|` for OR within a filter value (e.g. "2020|2021"), or use a `.search` filter or the `query` parameter for free-text phrases that contain commas.',
265
+ when: 'A filter value contains a comma, which collides with the OpenAlex filter separator, on a field that takes no phrase. Free-text search filters (any `.search` key, such as title.search or abstract.search.exact) and fields matched as whole text (display_name, awards.funder_display_name, awards.funder_award_id, geo.city, geo.region, raw_affiliation_strings, block_key, parsed_longest_name, biblio fields) are exempt: a comma there is sent quoted, as part of the phrase.',
266
+ recovery: 'Use `|` for OR within a filter value (e.g. "2020|2021"), or move a phrase that contains commas into a free-text search filter such as title.search or raw_affiliation_strings.search, or into the `query` parameter.',
267
+ thrownBy: 'service',
268
+ },
269
+ {
270
+ reason: 'invalid_country_code',
271
+ code: JsonRpcErrorCode.ValidationError,
272
+ when: 'A country filter (a key ending in country_code, country_codes, or countries) holds a segment that cannot be a country code, such as a misspelled name, an unassigned number, "unknown", or two codes joined by a space ("DE US").',
273
+ recovery: 'Pass the country as an ISO 3166-1 alpha-2 code such as DE, US, or GB (an alpha-3 code, numeric code, or English name is converted), or null for records with no country.',
274
+ thrownBy: 'service',
275
+ },
276
+ {
277
+ reason: 'mixed_and_or_in_filter_value',
278
+ code: JsonRpcErrorCode.ValidationError,
279
+ when: 'A filter value puts "|" (OR) beside an AND operator — a "+", or a space on a field where words mean AND (on a country field a space is always part of a country name, and inside a language name it is part of the name). OpenAlex splits the value on "|" first and drops every alternative that ANDs more than one value, so no single value can carry both.',
280
+ recovery: 'Keep "|" and the AND operator in separate filter keys: OR the alternatives in this key and put the AND in a second key that reaches the same values — on works, {"authorships.institutions.country_code": "DE|FR", "institutions.country_code": "US"} matches (DE or FR) and US. The filters object holds each key once, so where no second key fits, run one call per alternative instead.',
281
+ thrownBy: 'service',
282
+ },
283
+ {
284
+ reason: 'quote_in_filter_value',
285
+ code: JsonRpcErrorCode.ValidationError,
286
+ when: 'A filter value sent to OpenAlex double-quoted holds a double quote inside its outer pair — a value the server quotes (a multi-word value on a field matched as whole text, or a value holding a comma on such a field or on a free-text search filter), or one the caller wrapped in double quotes on any filter but a free-text search.',
287
+ recovery: 'Remove the double quote from the value; a phrase is matched without quoting its own text.',
196
288
  thrownBy: 'service',
197
289
  },
198
290
  {
@@ -245,7 +337,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
245
337
  .string()
246
338
  .min(1)
247
339
  .optional()
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.'),
340
+ .describe('Retrieve a single entity by ID. Supports: OpenAlex ID ("W2741809807", or its OpenAlex record-page or API URL such as "https://openalex.org/works/W2741809807" or "https://api.openalex.org/works/W2741809807"), whose letter must name `entity_type` — W works, A authors, S sources, I institutions, T topics, P publishers, F funders; DOI ("10.1038/nature12373"; under entity_type "funders", a funder\'s Crossref Funder Registry DOI such as "10.13039/100000001"), ORCID ("0000-0002-1825-0097"), ROR ("https://ror.org/00hx57361" — one ROR can name an institution, a funder, and a publisher, and `entity_type` picks which), 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.'),
249
341
  query: z
250
342
  .string()
251
343
  .min(1)
@@ -255,10 +347,9 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
255
347
  .enum(['keyword', 'exact', 'semantic'])
256
348
  .default('keyword')
257
349
  .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\`.`),
258
- filters: z
259
- .record(z.string(), z.string())
350
+ filters: normalizedFilters
260
351
  .optional()
261
- .describe('Filter criteria as field:value pairs. AND across fields (multiple keys). OR within field: pipe-separate ("us|gb"). NOT: prefix "!" ("!us"). Range: "2020-2024". Comparison: ">100", "<50". AND within same field: "+"-separate. Two keys that resolve to the same upstream field (an alias and its canonical name, e.g. `year` and `publication_year`) are both applied and AND\'d, so they narrow rather than override each other. Use OpenAlex IDs (not names) for entity filters — resolve names first. Common keys: `openalex` (filter by entity ID, e.g. {"openalex": "W123|W456"}), `cites` (works citing a given work), `publication_year` (range "2020-2024"), `authorships.author.id`, `type`, `is_oa`.'),
352
+ .describe('Filter criteria as field:value pairs. AND across fields (multiple keys). OR within field: pipe-separate ("us|gb"). NOT: prefix "!" ("!us"). Range: "2020-2024". Comparison: ">100", "<50". AND within same field: "+"-separate ("us+gb"); inside a `.search` value, a DOI, a date (a timestamp\'s "+00:00" offset), a URL field such as landing_page_url, an exactly matched name (display_name, awards.funder_display_name — "C++", "Erasmus+"), a biblio field (issue "1+2"), or awards.funder_award_id, "+" is a literal character. A value cannot mix "|" with an AND operator — a "+", or a space between values on an ID, code, or `language` key (a space inside a language name is part of the name, and a country field never reads a space as AND) — OpenAlex splits it on "|" first and drops every alternative that ANDs more than one value, so such a value is rejected; put the AND in a second key instead ("institutions.country_code": "US" beside "authorships.institutions.country_code": "DE|FR" on works). On a field matched as whole text (display_name, awards.funder_display_name, awards.funder_award_id, geo.city, geo.region, raw_affiliation_strings, block_key, biblio fields), a space is part of the value: "New York", "!New York", and "New York|Boston" match as written, but quotes around one "|" alternative make that alternative match nothing. A comma is part of such a value too ("University of California, Berkeley" on raw_affiliation_strings): a value holding one is sent as one quoted phrase, its "+" a literal character. A value sent as a quoted phrase cannot contain a double quote of its own. A multi-word value there cannot be ANDed with another ("New York+Boston" matches nothing); to require two funders or institutions, AND their IDs (awards.funder_id, authorships.institutions.id). Country fields (keys ending in country_code, country_codes, or countries) take ISO 3166-1 alpha-2 codes ("DE"): an alpha-3 code ("DEU"), numeric code ("276"), or English name ("Germany", "South Korea") is converted, "UK" becomes "GB", and a value that cannot be a country code is rejected. A space there is part of a name, never a separator: "South Korea|Japan" ORs two countries, and "DE US" is rejected. `language` takes ISO 639-1 codes ("en"): an ISO 639-2 code ("eng") or English name ("English") is converted. Two keys that resolve to the same upstream field (an alias and its canonical name, e.g. `year` and `publication_year`) are both applied and AND\'d, so they narrow rather than override each other. Use OpenAlex IDs (not names) for entity filters — resolve names first. Common keys: `openalex` (filter by entity ID, e.g. {"openalex": "W123|W456"}), `cites` (works citing a given work), `publication_year` (range "2020-2024"), `authorships.author.id`, `type`, `is_oa`.'),
262
353
  sort: z
263
354
  .string()
264
355
  .optional()
@@ -266,14 +357,10 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
266
357
  select: z
267
358
  .array(z.string())
268
359
  .optional()
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"].'),
270
- per_page: z
271
- .number()
272
- .int()
273
- .min(1)
274
- .max(100)
360
+ .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. On sources, `publisher` returns `host_organization_name`: the publisher of a journal, the hosting institution of a repository, and null on most sources. On works, `author_list` returns each author in authorship order as `{id, display_name, orcid}` (`orcid` null when absent), a compact alternative to `authorships`, which also carries institutions and affiliations; neither the default nor `["*"]` includes it. 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", "author_list", "primary_topic"].'),
361
+ per_page: pageSizeSchema(100)
275
362
  .default(25)
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`).'),
363
+ .describe('Results per page. Default 25; positive integers above 100 clamp to 100 with a notice unless OPENALEX_CLAMP_PER_PAGE=false restores rejection. Semantic search caps at 50 — when search_mode="semantic", set per_page ≤ 50 (also subject to a 1 req/sec rate limit upstream). The semantic cap checks the requested size. An `id` lookup ignores page size, and `sample` overrides it. A budget-cut page returns fewer (`omitted`).'),
277
364
  cursor: z
278
365
  .string()
279
366
  .min(1)
@@ -300,7 +387,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
300
387
  .object({
301
388
  field: z
302
389
  .string()
303
- .describe('Top-level array field to page, such as "authorships" or "referenced_works". Leave it empty to skip slicing.'),
390
+ .describe('Top-level array field to page, such as "authorships", "author_list", or "referenced_works". Leave it empty to skip slicing.'),
304
391
  offset: z
305
392
  .number()
306
393
  .int()
@@ -309,7 +396,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
309
396
  .describe('0-based index of the first element to return.'),
310
397
  })
311
398
  .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.'),
399
+ .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. A 100-author list cap can be continued on the singleton; at 5,000 stored authors the byline remains possibly capped, but `next` is null once stored entries are exhausted.'),
313
400
  }),
314
401
  output: z.object({
315
402
  meta: z
@@ -319,7 +406,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
319
406
  .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.'),
320
407
  per_page: z
321
408
  .number()
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`).'),
409
+ .describe('Page size OpenAlex echoed for this request — the applied per_page after clamping or sample override, not the number of records returned. A singleton reports 1. A short or exhausted page carries fewer records than this, as does a page the response budget cut (`omitted`).'),
323
410
  next_cursor: z
324
411
  .string()
325
412
  .nullable()
@@ -339,7 +426,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
339
426
  })
340
427
  .loose()
341
428
  .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`.'))
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`.'),
429
+ .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`, and a selected `author_list` as one `{id, display_name, orcid}` entry per author. 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
430
  omitted: omittedOutputSchema,
344
431
  windows: windowsOutputSchema,
345
432
  over_budget: overBudgetOutputSchema,
@@ -355,12 +442,12 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
355
442
  notice: z
356
443
  .string()
357
444
  .optional()
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.'),
445
+ .describe('Guidance notice. Set when per_page was clamped (requested and applied sizes), a native filter string was converted, a first call has no matches, a continuation is exhausted, an id lookup ignores search criteria, semantic search reports a candidate total, the response budget cut records, windowed an array, or ran over, an author array is possibly capped (100 list entries or 5,000 stored singleton entries), a slice offset is past the end, or slice replaces select. Absent otherwise.'),
359
446
  budget: z
360
447
  .object({
361
448
  costUsd: z
362
449
  .number()
363
- .describe('USD this call spent. 0 for an `id` lookup — OpenAlex does not bill single-entity fetches, so batching known IDs beats paging a filtered list.'),
450
+ .describe('USD this call spent. 0 for an `id` lookup by an OpenAlex ID, DOI, ORCID, ROR, PMID, or ISSN — OpenAlex does not bill those single-entity fetches, so batching known IDs beats paging a filtered list. OpenAlex bills like one list request a keyword looked up by its slug, an `id` carrying characters past the identifier itself (`W2741809807#x` still returns W2741809807), and a funder looked up by its Funder Registry DOI.'),
364
451
  remainingUsd: z.number().describe("USD left in today's OpenAlex budget after this call."),
365
452
  resetsInSeconds: z
366
453
  .number()
@@ -378,7 +465,13 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
378
465
  totalCount: { label: 'Total' },
379
466
  budget: { render: renderBudgetTrailer },
380
467
  },
381
- async handler(input, ctx) {
468
+ async handler(parsedInput, ctx) {
469
+ const { filters: normalized, ...rest } = parsedInput;
470
+ const input = { ...rest, filters: normalized?.value };
471
+ if (normalized?.converted) {
472
+ ctx.log.info('Converted native filter string', { tool: 'openalex_search_entities' });
473
+ filterStringConversions.add(1, { [ATTR_MCP_TOOL_NAME]: 'openalex_search_entities' });
474
+ }
382
475
  // A form client sends an empty `slice.field` for an unset slice; an empty field is no slice.
383
476
  const slice = input.slice?.field ? input.slice : undefined;
384
477
  if (slice && !input.id) {
@@ -441,6 +534,9 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
441
534
  throw ctx.fail('seed_without_sample', '`seed` is only meaningful with `sample` — pass `sample` to enable random sampling.', { seed: input.seed });
442
535
  }
443
536
  }
537
+ const pageSize = input.id || input.sample !== undefined
538
+ ? { applied: input.per_page, notice: undefined }
539
+ : clampPageSize(input.per_page, 100, 'openalex_search_entities', ctx);
444
540
  const service = getOpenAlexService();
445
541
  const result = await service.search({
446
542
  entityType: input.entity_type,
@@ -450,7 +546,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
450
546
  filters: input.filters,
451
547
  sort: input.sort,
452
548
  select: slice ? [slice.field] : input.select,
453
- perPage: input.per_page,
549
+ perPage: pageSize.applied,
454
550
  cursor: input.cursor,
455
551
  page: input.page,
456
552
  sample: input.sample,
@@ -466,6 +562,11 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
466
562
  const echo = buildSearchEcho(input);
467
563
  ctx.enrich({ echo, totalCount: result.meta.count });
468
564
  const notices = [];
565
+ if (pageSize.notice)
566
+ notices.push(pageSize.notice);
567
+ if (normalized?.converted) {
568
+ notices.push('Converted native filter string to a filters record object.');
569
+ }
469
570
  // An `id` lookup always returns its one record or throws, so it never reaches the
470
571
  // empty-results notice — the two branches are exclusive, and the dropped-parameter
471
572
  // warning is the more useful of the two on that path.
@@ -500,13 +601,15 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
500
601
  notice: joinNotices([...notices, budgetNotice]),
501
602
  });
502
603
  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);
604
+ // A slice without an `id` was refused as `slice_without_id`, so `input.id` only narrows here.
605
+ if (slice && input.id) {
606
+ // The one-field projection lands under its record key — `authors` arrives as `authorships`,
607
+ // and `author_list` as itself.
608
+ const field = selectRecordKey(input.entity_type, slice.field);
506
609
  const [record] = result.results;
507
610
  const items = record?.[field];
508
611
  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 });
612
+ throw ctx.fail('slice_field_not_array', `${quoteCallerText(slice.field)} is not an array on the record at ${quoteCallerText(input.id)}.`, { field: slice.field, id: input.id });
510
613
  }
511
614
  if (slice.offset > items.length) {
512
615
  notices.push(`slice.offset ${slice.offset} is past the end of \`${field}\`, which holds ${items.length} element(s), so nothing follows.`);
@@ -1 +1 @@
1
- {"version":3,"file":"search-entities.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-entities.tool.ts"],"names":[],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,MAAM,CAAC,OAAO;gBACvB,UAAU,EAAE,KAAK,CAAC,WAAW;gBAC7B,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM;gBAClC,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,YAAY;aACb,CAAC,CAAC;QACL,CAAC;QAED,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACtD,IAAI,MAAM;YAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEtC,OAAO,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"}
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,kBAAkB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAChF,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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,CAAC,CAAC,CAAC;QACtD,IAAI,MAAM;YAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEtC,OAAO,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,18 @@
1
+ /**
2
+ * @fileoverview Page-size validation and disclosed clamping for OpenAlex list tools.
3
+ * @module mcp-server/tools/page-size
4
+ */
5
+ import { type Context, z } from '@cyanheads/mcp-ts-core';
6
+ type PagedTool = 'openalex_search_entities' | 'openalex_get_citation_graph' | 'openalex_analyze_trends';
7
+ /** Resolves lazily so environment parsing remains at application setup, including schema discovery. */
8
+ export declare function pageSizeSchema(maximum: 100 | 200): z.ZodLazy<z.ZodNumber>;
9
+ /** Apply only when the caller's page size is used; IDs and samples take precedence in search. */
10
+ export declare function clampPageSize(requested: number, maximum: 100 | 200, tool: PagedTool, ctx: Context): {
11
+ applied: number;
12
+ notice: undefined;
13
+ } | {
14
+ applied: 100 | 200;
15
+ notice: string;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=page-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-size.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/page-size.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAKzD,KAAK,SAAS,GACV,0BAA0B,GAC1B,6BAA6B,GAC7B,yBAAyB,CAAC;AAE9B,uGAAuG;AACvG,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,0BAKhD;AAED,iGAAiG;AACjG,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,GAAG,GAAG,EAClB,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,OAAO;;;;;;EAWb"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @fileoverview Page-size validation and disclosed clamping for OpenAlex list tools.
3
+ * @module mcp-server/tools/page-size
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { ATTR_MCP_TOOL_NAME, createCounter } from '@cyanheads/mcp-ts-core/utils';
7
+ import { getServerConfig } from '../../config/server-config.js';
8
+ const clamps = createCounter('openalex.per_page.clamps', 'Oversized page sizes clamped', '{clamp}');
9
+ /** Resolves lazily so environment parsing remains at application setup, including schema discovery. */
10
+ export function pageSizeSchema(maximum) {
11
+ return z.lazy(() => {
12
+ const schema = z.number().int().min(1);
13
+ return getServerConfig().clampPerPage ? schema : schema.max(maximum);
14
+ });
15
+ }
16
+ /** Apply only when the caller's page size is used; IDs and samples take precedence in search. */
17
+ export function clampPageSize(requested, maximum, tool, ctx) {
18
+ if (requested <= maximum || !getServerConfig().clampPerPage) {
19
+ return { applied: requested, notice: undefined };
20
+ }
21
+ ctx.log.info('Clamped per_page', { tool, requested, applied: maximum });
22
+ clamps.add(1, { [ATTR_MCP_TOOL_NAME]: tool, 'openalex.per_page.maximum': maximum });
23
+ return {
24
+ applied: maximum,
25
+ notice: `per_page ${requested} exceeds the maximum of ${maximum}; using per_page ${maximum}.`,
26
+ };
27
+ }
28
+ //# sourceMappingURL=page-size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-size.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/page-size.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,MAAM,GAAG,aAAa,CAAC,0BAA0B,EAAE,8BAA8B,EAAE,SAAS,CAAC,CAAC;AAMpG,uGAAuG;AACvG,MAAM,UAAU,cAAc,CAAC,OAAkB;IAC/C,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACjB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACvC,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,aAAa,CAC3B,SAAiB,EACjB,OAAkB,EAClB,IAAe,EACf,GAAY;IAEZ,IAAI,SAAS,IAAI,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC,YAAY,EAAE,CAAC;QAC5D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACnD,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,2BAA2B,EAAE,OAAO,EAAE,CAAC,CAAC;IACpF,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,YAAY,SAAS,2BAA2B,OAAO,oBAAoB,OAAO,GAAG;KAC9F,CAAC;AACJ,CAAC"}
@@ -7,8 +7,10 @@
7
7
  import type { UpstreamBudget } from '../../services/openalex/budget.js';
8
8
  /**
9
9
  * One-line budget trailer. `costUsd: 0` renders as "free" rather than `$0.0000` because it
10
- * carries real signal — it means the call was a singleton ID lookup, which OpenAlex does not
11
- * bill, so batching by ID beats paging a filtered list. The prepaid segment appears only for
10
+ * carries real signal — OpenAlex billed none of the call's requests: an autocomplete, or a by-ID
11
+ * lookup of an OpenAlex ID, DOI, or other external identifier (a keyword slug, or an ID with
12
+ * characters past it such as `W2741809807#x`, bills like a list request instead), so batching
13
+ * known IDs beats paging a filtered list. The prepaid segment appears only for
12
14
  * an account holding that balance: without it, "left today" is the whole spendable figure;
13
15
  * with it, the daily line alone reads as broke on an account that keeps serving.
14
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"render-budget.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/render-budget.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAgBpE;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,CAQ9E"}
1
+ {"version":3,"file":"render-budget.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/render-budget.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAgBpE;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,CAQ9E"}
@@ -19,8 +19,10 @@ function formatCountdown(seconds) {
19
19
  }
20
20
  /**
21
21
  * One-line budget trailer. `costUsd: 0` renders as "free" rather than `$0.0000` because it
22
- * carries real signal — it means the call was a singleton ID lookup, which OpenAlex does not
23
- * bill, so batching by ID beats paging a filtered list. The prepaid segment appears only for
22
+ * carries real signal — OpenAlex billed none of the call's requests: an autocomplete, or a by-ID
23
+ * lookup of an OpenAlex ID, DOI, or other external identifier (a keyword slug, or an ID with
24
+ * characters past it such as `W2741809807#x`, bills like a list request instead), so batching
25
+ * known IDs beats paging a filtered list. The prepaid segment appears only for
24
26
  * an account holding that balance: without it, "left today" is the whole spendable figure;
25
27
  * with it, the daily line alone reads as broke on an account that keeps serving.
26
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"render-budget.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/render-budget.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,kGAAkG;AAClG,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;AAC3C,CAAC;AAED,SAAS,eAAe,CAAC,OAAe;IACtC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACzC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,GAAG,CAAC;IACvC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,KAAK,OAAO,GAAG,EAAE,GAAG,CAAC;AACzD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAkC;IACpE,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvE,MAAM,OAAO,GACX,MAAM,CAAC,mBAAmB,KAAK,SAAS;QACtC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,MAAM,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC;IAC5D,OAAO,eAAe,IAAI,gBAAgB,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,OAAO,eAAe,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC;AACzJ,CAAC"}
1
+ {"version":3,"file":"render-budget.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/render-budget.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,kGAAkG;AAClG,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;AAC3C,CAAC;AAED,SAAS,eAAe,CAAC,OAAe;IACtC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACzC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,GAAG,CAAC;IACvC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,KAAK,OAAO,GAAG,EAAE,GAAG,CAAC;AACzD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAkC;IACpE,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvE,MAAM,OAAO,GACX,MAAM,CAAC,mBAAmB,KAAK,SAAS;QACtC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,MAAM,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC;IAC5D,OAAO,eAAe,IAAI,gBAAgB,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,OAAO,eAAe,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC;AACzJ,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * `structuredContent` and the summed `content[]` text, enrichment trailer included — to
5
5
  * 64,000 bytes: a list page loses whole records from its end, a record too large on its own has
6
6
  * its biggest arrays windowed, and every cut is disclosed with the call that continues it. The
7
- * same pass flags list records carrying exactly 100 authorships, OpenAlex's list-response cap.
7
+ * same pass discloses OpenAlex's 100-author list cap and 5,000-author singleton storage cap.
8
8
  * @module mcp-server/tools/response-budget
9
9
  */
10
10
  import { z } from '@cyanheads/mcp-ts-core';
@@ -122,8 +122,8 @@ export interface FitRecordsRequest {
122
122
  entityType: EntityType;
123
123
  measureFrame: FrameMeasure;
124
124
  /**
125
- * `list` pages cut whole records and check the authorship cap; a `lookup` holds one record,
126
- * which OpenAlex returns uncapped, so it can only be windowed.
125
+ * `list` pages cut whole records and check the 100-author cap; a `lookup` holds one record
126
+ * and checks the 5,000-author storage cap.
127
127
  */
128
128
  path: 'list' | 'lookup';
129
129
  records: readonly EntityRecord[];
@@ -1 +1 @@
1
- {"version":3,"file":"response-budget.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/response-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAK3C,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE7E,wFAAwF;AACxF,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAQ5C;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAiBhD,QAAA,MAAM,iBAAiB;;;;;;;;;;;iBAgBkB,CAAC;AAE1C,gGAAgG;AAChG,eAAO,MAAM,mBAAmB;;;;;;kBAY7B,CAAC;AAEJ,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB;;;;;;;;;;;mBAK7B,CAAC;AAEJ,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,6BAKhC,CAAC;AAGJ,KAAK,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,C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