@cyanheads/openalex-mcp-server 0.8.0 → 0.9.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 (54) hide show
  1. package/AGENTS.md +20 -7
  2. package/CLAUDE.md +20 -7
  3. package/Dockerfile +17 -8
  4. package/README.md +20 -17
  5. package/changelog/0.9.x/0.9.0.md +48 -0
  6. package/dist/mcp-server/prompts/definitions/literature-review.prompt.js +1 -1
  7. package/dist/mcp-server/prompts/definitions/research-landscape.prompt.js +1 -1
  8. package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts +27 -2
  9. package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts.map +1 -1
  10. package/dist/mcp-server/tools/definitions/analyze-trends.tool.js +34 -4
  11. package/dist/mcp-server/tools/definitions/analyze-trends.tool.js.map +1 -1
  12. package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts +41 -4
  13. package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts.map +1 -1
  14. package/dist/mcp-server/tools/definitions/citation-graph.tool.js +62 -14
  15. package/dist/mcp-server/tools/definitions/citation-graph.tool.js.map +1 -1
  16. package/dist/mcp-server/tools/definitions/describe-fields.tool.d.ts.map +1 -1
  17. package/dist/mcp-server/tools/definitions/describe-fields.tool.js +34 -4
  18. package/dist/mcp-server/tools/definitions/describe-fields.tool.js.map +1 -1
  19. package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts +37 -1
  20. package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts.map +1 -1
  21. package/dist/mcp-server/tools/definitions/resolve-name.tool.js +175 -40
  22. package/dist/mcp-server/tools/definitions/resolve-name.tool.js.map +1 -1
  23. package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts +41 -4
  24. package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts.map +1 -1
  25. package/dist/mcp-server/tools/definitions/search-entities.tool.js +71 -23
  26. package/dist/mcp-server/tools/definitions/search-entities.tool.js.map +1 -1
  27. package/dist/mcp-server/tools/render-budget.d.ts +4 -2
  28. package/dist/mcp-server/tools/render-budget.d.ts.map +1 -1
  29. package/dist/mcp-server/tools/render-budget.js +4 -2
  30. package/dist/mcp-server/tools/render-budget.js.map +1 -1
  31. package/dist/mcp-server/tools/response-budget.d.ts +2 -1
  32. package/dist/mcp-server/tools/response-budget.d.ts.map +1 -1
  33. package/dist/mcp-server/tools/response-budget.js +30 -21
  34. package/dist/mcp-server/tools/response-budget.js.map +1 -1
  35. package/dist/services/openalex/budget.d.ts +3 -1
  36. package/dist/services/openalex/budget.d.ts.map +1 -1
  37. package/dist/services/openalex/budget.js +3 -1
  38. package/dist/services/openalex/budget.js.map +1 -1
  39. package/dist/services/openalex/field-catalog.json +50 -1
  40. package/dist/services/openalex/filter-values.d.ts +46 -0
  41. package/dist/services/openalex/filter-values.d.ts.map +1 -0
  42. package/dist/services/openalex/filter-values.js +294 -0
  43. package/dist/services/openalex/filter-values.js.map +1 -0
  44. package/dist/services/openalex/iso-codes.json +1565 -0
  45. package/dist/services/openalex/openalex-service.d.ts +172 -20
  46. package/dist/services/openalex/openalex-service.d.ts.map +1 -1
  47. package/dist/services/openalex/openalex-service.js +560 -120
  48. package/dist/services/openalex/openalex-service.js.map +1 -1
  49. package/dist/services/openalex/provider-text.d.ts +7 -6
  50. package/dist/services/openalex/provider-text.d.ts.map +1 -1
  51. package/dist/services/openalex/provider-text.js +485 -61
  52. package/dist/services/openalex/provider-text.js.map +1 -1
  53. package/package.json +14 -12
  54. package/server.json +10 -24
@@ -6,7 +6,8 @@ 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
8
  import { fitRecordsToBudget, fitSliceToBudget, formatRecordPage, joinNotices, measurePageFrame, omittedOutputSchema, overBudgetOutputSchema, windowsOutputSchema, } from '../response-budget.js';
9
- import { getOpenAlexService, translateSelectField } from '../../../services/openalex/openalex-service.js';
9
+ import { quoteCallerText } from '../../../services/openalex/filter-values.js';
10
+ import { getOpenAlexService, selectRecordKey } from '../../../services/openalex/openalex-service.js';
10
11
  import { ENTITY_TYPES } from '../../../services/openalex/types.js';
11
12
  const SEMANTIC_PER_PAGE_CAP = 50;
12
13
  const SAMPLE_MAX = 100;
@@ -25,7 +26,7 @@ const RESULT_NOUN = 'result(s)';
25
26
  function searchOnlyParams(input) {
26
27
  const parts = [];
27
28
  if (input.query)
28
- parts.push({ name: 'query', rendered: `query="${input.query}"` });
29
+ parts.push({ name: 'query', rendered: `query=${JSON.stringify(input.query)}` });
29
30
  if (input.search_mode && input.search_mode !== 'keyword') {
30
31
  parts.push({ name: 'search_mode', rendered: `search_mode=${input.search_mode}` });
31
32
  }
@@ -33,23 +34,25 @@ function searchOnlyParams(input) {
33
34
  parts.push({ name: 'filters', rendered: `filters=${JSON.stringify(input.filters)}` });
34
35
  }
35
36
  if (input.sort)
36
- parts.push({ name: 'sort', rendered: `sort=${input.sort}` });
37
+ parts.push({ name: 'sort', rendered: `sort=${JSON.stringify(input.sort)}` });
37
38
  if (input.sample !== undefined) {
38
39
  parts.push({ name: 'sample', rendered: `sample=${input.sample}` });
39
40
  }
40
- if (input.seed !== undefined)
41
- parts.push({ name: 'seed', rendered: `seed=${input.seed}` });
41
+ if (input.seed !== undefined) {
42
+ parts.push({ name: 'seed', rendered: `seed=${JSON.stringify(input.seed)}` });
43
+ }
42
44
  return parts;
43
45
  }
44
46
  /**
45
47
  * Echo the criteria that actually ran. An `id` lookup echoes `entity_type` and `id` only —
46
48
  * 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.
49
+ * is the one thing this field exists not to do. Caller text is JSON-encoded, so a line break in
50
+ * it cannot start a heading or end the line the echo renders on.
48
51
  */
49
52
  function buildSearchEcho(input) {
50
53
  const parts = [`entity_type=${input.entity_type}`];
51
54
  if (input.id)
52
- return [...parts, `id=${input.id}`].join(' | ');
55
+ return [...parts, `id=${JSON.stringify(input.id)}`].join(' | ');
53
56
  return [...parts, ...searchOnlyParams(input).map((part) => part.rendered)].join(' | ');
54
57
  }
55
58
  /**
@@ -133,7 +136,21 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
133
136
  reason: 'slice_field_not_array',
134
137
  code: JsonRpcErrorCode.ValidationError,
135
138
  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.',
139
+ 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.',
140
+ },
141
+ {
142
+ reason: 'id_type_mismatch',
143
+ code: JsonRpcErrorCode.ValidationError,
144
+ 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.',
145
+ 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.',
146
+ thrownBy: 'service',
147
+ },
148
+ {
149
+ reason: 'id_dot_segment',
150
+ code: JsonRpcErrorCode.ValidationError,
151
+ when: '`id` holds a `.` or `..` path segment, written plainly or percent-encoded.',
152
+ 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`.',
153
+ thrownBy: 'service',
137
154
  },
138
155
  {
139
156
  reason: 'entity_not_found',
@@ -158,6 +175,14 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
158
175
  recovery: "This server's daily OpenAlex budget is spent and refills at midnight UTC — retrying before then will not succeed.",
159
176
  thrownBy: 'service',
160
177
  },
178
+ {
179
+ reason: 'upstream_plan_required',
180
+ code: JsonRpcErrorCode.Forbidden,
181
+ 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").',
182
+ retryable: false,
183
+ 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.',
184
+ thrownBy: 'service',
185
+ },
161
186
  {
162
187
  reason: 'upstream_timeout',
163
188
  code: JsonRpcErrorCode.Timeout,
@@ -169,7 +194,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
169
194
  {
170
195
  reason: 'upstream_unavailable',
171
196
  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.',
197
+ 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
198
  retryable: true,
174
199
  recovery: 'Wait and retry; check https://openalex.org for service status if the outage persists.',
175
200
  thrownBy: 'service',
@@ -191,8 +216,29 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
191
216
  {
192
217
  reason: 'comma_in_filter_value',
193
218
  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.',
219
+ 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.',
220
+ 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.',
221
+ thrownBy: 'service',
222
+ },
223
+ {
224
+ reason: 'invalid_country_code',
225
+ code: JsonRpcErrorCode.ValidationError,
226
+ 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").',
227
+ 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.',
228
+ thrownBy: 'service',
229
+ },
230
+ {
231
+ reason: 'mixed_and_or_in_filter_value',
232
+ code: JsonRpcErrorCode.ValidationError,
233
+ 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.',
234
+ 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.',
235
+ thrownBy: 'service',
236
+ },
237
+ {
238
+ reason: 'quote_in_filter_value',
239
+ code: JsonRpcErrorCode.ValidationError,
240
+ 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.',
241
+ recovery: 'Remove the double quote from the value; a phrase is matched without quoting its own text.',
196
242
  thrownBy: 'service',
197
243
  },
198
244
  {
@@ -245,7 +291,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
245
291
  .string()
246
292
  .min(1)
247
293
  .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.'),
294
+ .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
295
  query: z
250
296
  .string()
251
297
  .min(1)
@@ -258,7 +304,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
258
304
  filters: z
259
305
  .record(z.string(), z.string())
260
306
  .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`.'),
307
+ .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
308
  sort: z
263
309
  .string()
264
310
  .optional()
@@ -266,7 +312,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
266
312
  select: z
267
313
  .array(z.string())
268
314
  .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"].'),
315
+ .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"].'),
270
316
  per_page: z
271
317
  .number()
272
318
  .int()
@@ -300,7 +346,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
300
346
  .object({
301
347
  field: z
302
348
  .string()
303
- .describe('Top-level array field to page, such as "authorships" or "referenced_works". Leave it empty to skip slicing.'),
349
+ .describe('Top-level array field to page, such as "authorships", "author_list", or "referenced_works". Leave it empty to skip slicing.'),
304
350
  offset: z
305
351
  .number()
306
352
  .int()
@@ -309,7 +355,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
309
355
  .describe('0-based index of the first element to return.'),
310
356
  })
311
357
  .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.'),
358
+ .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-entry `authorships` or `author_list`.'),
313
359
  }),
314
360
  output: z.object({
315
361
  meta: z
@@ -339,7 +385,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
339
385
  })
340
386
  .loose()
341
387
  .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`.'),
388
+ .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
389
  omitted: omittedOutputSchema,
344
390
  windows: windowsOutputSchema,
345
391
  over_budget: overBudgetOutputSchema,
@@ -355,12 +401,12 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
355
401
  notice: z
356
402
  .string()
357
403
  .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.'),
404
+ .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 or author_list entries (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.'),
359
405
  budget: z
360
406
  .object({
361
407
  costUsd: z
362
408
  .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.'),
409
+ .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
410
  remainingUsd: z.number().describe("USD left in today's OpenAlex budget after this call."),
365
411
  resetsInSeconds: z
366
412
  .number()
@@ -500,13 +546,15 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
500
546
  notice: joinNotices([...notices, budgetNotice]),
501
547
  });
502
548
  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);
549
+ // A slice without an `id` was refused as `slice_without_id`, so `input.id` only narrows here.
550
+ if (slice && input.id) {
551
+ // The one-field projection lands under its record key — `authors` arrives as `authorships`,
552
+ // and `author_list` as itself.
553
+ const field = selectRecordKey(input.entity_type, slice.field);
506
554
  const [record] = result.results;
507
555
  const items = record?.[field];
508
556
  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 });
557
+ 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
558
  }
511
559
  if (slice.offset > items.length) {
512
560
  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":[],"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,CAAC;AACnG,OAAO,EA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E,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,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,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,wDAAwD;AACxD,MAAM,WAAW,GAAG,WAAW,CAAC;AAahC;;;;;;;;;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,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IACjG,IAAI,KAAK,CAAC,WAAW,IAAI,KAA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AK,mBAAmB,KAAK,CAAC,MAAM,kCAAkC,CAC5H,CAAC;YACJ,CAAC;YACD,IAAI,GAAG,gBAAgB,CAAC;gBACtB,MAAM;gBACN,KAAK;gBACL,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,UAAU,EAAE,KAAK,CAAC,WAAW;gBAC7B,YAAY;aACb,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,kBAAkB,CAAC;gBACxB,OAAO,EAAE,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"}
@@ -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":[],"m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G,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,8 @@
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 flags list records carrying exactly 100 authorships (or the 100 `author_list` entries
8
+ * derived from them), OpenAlex's list-response cap.
8
9
  * @module mcp-server/tools/response-budget
9
10
  */
10
11
  import { z } from '@cyanheads/mcp-ts-core';
@@ -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,CAAC;AACrD,KAAK,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC;AAEhE,qGAAqG;AACrG,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;CACrC;AAED,4FAA4F;AAC5F,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAClD,IAAI,EAAE;QAAE,KAAK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Ae,GAAG,YAAY,CA8BvE"}
@@ -4,7 +4,8 @@
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 flags list records carrying exactly 100 authorships (or the 100 `author_list` entries
8
+ * derived from them), OpenAlex's list-response cap.
8
9
  * @module mcp-server/tools/response-budget
9
10
  */
10
11
  import { z } from '@cyanheads/mcp-ts-core';
@@ -16,6 +17,8 @@ export const RESPONSE_BUDGET_BYTES = 64_000;
16
17
  * lookup returns them all. Exactly this many on a list record may or may not be the whole list.
17
18
  */
18
19
  const LIST_AUTHORSHIPS_CAP = 100;
20
+ /** Record arrays the cap applies to: `authorships`, and the `author_list` derived from it. */
21
+ const CAPPED_AUTHOR_FIELDS = ['authorships', 'author_list'];
19
22
  /**
20
23
  * Bytes reserved on each surface for the `budget` enrichment field. The service writes it from
21
24
  * OpenAlex's rate-limit headers through `ctx.enrich`, so its value is not in the handler's hands
@@ -46,7 +49,7 @@ const arrayWindowSchema = z
46
49
  total: z.number().describe('Array length as returned to this call.'),
47
50
  possibly_capped: z
48
51
  .boolean()
49
- .describe("True for exactly 100 authorships on a list record (OpenAlex's cap): the list may be longer."),
52
+ .describe("True for exactly 100 `authorships` or `author_list` entries on a list record (OpenAlex's cap): the list may be longer."),
50
53
  next: continuationCallSchema
51
54
  .nullable()
52
55
  .describe('`id` + `slice` call for the next elements; null at the array end.'),
@@ -66,7 +69,7 @@ export const omittedOutputSchema = z
66
69
  export const windowsOutputSchema = z
67
70
  .array(arrayWindowSchema)
68
71
  .optional()
69
- .describe('Arrays returned in part — windowed to fit the budget, paged by `slice`, or 100 possibly capped authorships — each with its continuation. A `slice` call always carries its window, even for a whole array; otherwise absent when every array is whole.');
72
+ .describe('Arrays returned in part — windowed to fit the budget, paged by `slice`, or a possibly capped 100-entry `authorships` or `author_list` — each with its continuation. A `slice` call always carries its window, even for a whole array; otherwise absent when every array is whole.');
70
73
  /** Output field: the least this call can return does not fit the budget on its own. */
71
74
  export const overBudgetOutputSchema = z
72
75
  .boolean()
@@ -238,13 +241,17 @@ function arrayWindow(entityType, record, field, view) {
238
241
  : null,
239
242
  };
240
243
  }
241
- function isCappedListRecord(record, capCheck) {
242
- return (capCheck &&
243
- Array.isArray(record.authorships) &&
244
- record.authorships.length === LIST_AUTHORSHIPS_CAP);
244
+ /** The author arrays of a list record holding exactly the cap; none when `capCheck` is off. */
245
+ function cappedListFields(record, capCheck) {
246
+ if (!capCheck)
247
+ return [];
248
+ return CAPPED_AUTHOR_FIELDS.filter((field) => {
249
+ const items = record[field];
250
+ return Array.isArray(items) && items.length === LIST_AUTHORSHIPS_CAP;
251
+ });
245
252
  }
246
- function capWindow(entityType, record) {
247
- return arrayWindow(entityType, record, 'authorships', {
253
+ function capWindow(entityType, record, field) {
254
+ return arrayWindow(entityType, record, field, {
248
255
  offset: 0,
249
256
  shown: LIST_AUTHORSHIPS_CAP,
250
257
  total: LIST_AUTHORSHIPS_CAP,
@@ -264,7 +271,7 @@ function budgetNotice(parts) {
264
271
  ? "The first record's non-array fields alone exceed the budget, so this response runs over it."
265
272
  : undefined,
266
273
  cappedCount > 0
267
- ? `${cappedCount} record(s) carry exactly ${LIST_AUTHORSHIPS_CAP} authorships, the most OpenAlex returns on a list record, so the author list may be longer; the \`windows\` entry gives the \`id\` + \`slice\` call for the rest.`
274
+ ? `${cappedCount} record(s) carry exactly ${LIST_AUTHORSHIPS_CAP} authorships or author_list entries, the most OpenAlex returns on a list record, so the author list may be longer; each such array's \`windows\` entry gives the \`id\` + \`slice\` call for the rest.`
268
275
  : undefined,
269
276
  ]);
270
277
  }
@@ -307,11 +314,13 @@ export function fitRecordsToBudget(request) {
307
314
  let recordBytes = charges.reduce((sum, charge) => sum + charge, 0);
308
315
  for (let kept = records.length; kept >= 1; kept--) {
309
316
  const keptRecords = records.slice(0, kept);
310
- const capped = keptRecords.filter((record) => isCappedListRecord(record, capCheck));
317
+ const capped = keptRecords
318
+ .map((record) => ({ record, fields: cappedListFields(record, capCheck) }))
319
+ .filter(({ fields }) => fields.length > 0);
311
320
  const page = assemblePage({
312
321
  kept: keptRecords,
313
322
  omitted: records.slice(kept),
314
- windows: capped.map((record) => capWindow(entityType, record)),
323
+ windows: capped.flatMap(({ record, fields }) => fields.map((field) => capWindow(entityType, record, field))),
315
324
  windowedCount: 0,
316
325
  cappedCount: capped.length,
317
326
  overBudget: false,
@@ -325,7 +334,7 @@ export function fitRecordsToBudget(request) {
325
334
  const [first, ...rest] = records;
326
335
  if (!first)
327
336
  return { results: [], disclosure: {}, notice: undefined };
328
- return windowRecord(first, rest, isCappedListRecord(first, capCheck), request);
337
+ return windowRecord(first, rest, cappedListFields(first, capCheck), request);
329
338
  }
330
339
  /**
331
340
  * Fill windowed arrays round-robin: each array in turn takes its next leading element while it
@@ -377,14 +386,14 @@ function windowRecord(record, rest, capped, request) {
377
386
  .filter((entry) => Array.isArray(entry[1]) && entry[1].length > 0)
378
387
  .map(([field, items]) => ({ field, items, bytes: utf8Bytes(JSON.stringify(items)) }))
379
388
  .sort((a, b) => b.bytes - a.bytes);
380
- /** Window entries for `shown` counts per windowed field, plus the cap entry when it applies. */
389
+ /** Window entries for `shown` counts per windowed field, plus the cap entries that apply. */
381
390
  const windowsFor = (shown) => {
382
391
  const entries = [];
383
392
  for (const [field, items] of Object.entries(record)) {
384
393
  if (!Array.isArray(items))
385
394
  continue;
386
395
  const count = shown.get(field);
387
- const cappedField = capped && field === 'authorships';
396
+ const cappedField = capped.includes(field);
388
397
  if (count !== undefined && count < items.length) {
389
398
  entries.push(arrayWindow(entityType, record, field, {
390
399
  offset: 0,
@@ -394,7 +403,7 @@ function windowRecord(record, rest, capped, request) {
394
403
  }));
395
404
  }
396
405
  else if (cappedField) {
397
- entries.push(capWindow(entityType, record));
406
+ entries.push(capWindow(entityType, record, field));
398
407
  }
399
408
  }
400
409
  return entries;
@@ -404,7 +413,7 @@ function windowRecord(record, rest, capped, request) {
404
413
  omitted: rest,
405
414
  windows,
406
415
  windowedCount: windows.filter((w) => w.shown < w.total).length,
407
- cappedCount: capped ? 1 : 0,
416
+ cappedCount: capped.length > 0 ? 1 : 0,
408
417
  overBudget,
409
418
  });
410
419
  for (let count = 1; count <= arrays.length; count++) {
@@ -414,13 +423,13 @@ function windowRecord(record, rest, capped, request) {
414
423
  offset: 0,
415
424
  shown: array.items.length,
416
425
  total: array.items.length + 1,
417
- possiblyCapped: capped && array.field === 'authorships',
426
+ possiblyCapped: capped.includes(array.field),
418
427
  }));
419
428
  const boundWindows = [
420
429
  ...bound,
421
- ...(capped && !windowed.some((a) => a.field === 'authorships')
422
- ? [capWindow(entityType, record)]
423
- : []),
430
+ ...capped
431
+ .filter((field) => !windowed.some((array) => array.field === field))
432
+ .map((field) => capWindow(entityType, record, field)),
424
433
  ];
425
434
  const boundPage = assemblePage(partsFor(record, boundWindows, false), entityType, select);
426
435
  const available = RESPONSE_BUDGET_BYTES - frameBytes(measureFrame(boundPage.disclosure, boundPage.notice));