@cyanheads/openalex-mcp-server 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/CLAUDE.md +2 -2
- package/Dockerfile +1 -1
- package/LICENSE +1 -1
- package/README.md +7 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/prompts/definitions/literature-review.prompt.d.ts +1 -1
- package/dist/mcp-server/prompts/definitions/research-landscape.prompt.js +1 -1
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts +30 -9
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.js +30 -5
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts +27 -6
- package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/citation-graph.tool.js +36 -8
- package/dist/mcp-server/tools/definitions/citation-graph.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/describe-fields.tool.d.ts +5 -5
- package/dist/mcp-server/tools/definitions/describe-fields.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/describe-fields.tool.js +26 -3
- package/dist/mcp-server/tools/definitions/describe-fields.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts +30 -9
- package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/resolve-name.tool.js +30 -5
- package/dist/mcp-server/tools/definitions/resolve-name.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts +32 -11
- package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-entities.tool.js +36 -8
- package/dist/mcp-server/tools/definitions/search-entities.tool.js.map +1 -1
- package/dist/services/openalex/openalex-service.d.ts +3 -1
- package/dist/services/openalex/openalex-service.d.ts.map +1 -1
- package/dist/services/openalex/openalex-service.js +134 -12
- package/dist/services/openalex/openalex-service.js.map +1 -1
- package/dist/services/openalex/types.d.ts +7 -2
- package/dist/services/openalex/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/server.json +3 -3
|
@@ -8,10 +8,29 @@ import { getFieldCatalog } from '../../../services/openalex/openalex-service.js'
|
|
|
8
8
|
import { ENTITY_TYPES } from '../../../services/openalex/types.js';
|
|
9
9
|
/** Contexts the caller can query; group_by resolves to the filter set upstream. */
|
|
10
10
|
const CONTEXTS = ['filter', 'group_by', 'select'];
|
|
11
|
-
/** Resolve group_by → filter
|
|
11
|
+
/** Resolve group_by → the filter catalog key; the handler then prunes non-groupable fields. */
|
|
12
12
|
function resolveContext(context) {
|
|
13
13
|
return context === 'select' ? 'select' : 'filter';
|
|
14
14
|
}
|
|
15
|
+
/** Raw date fields OpenAlex rejects as group_by targets — valid as filters, not as aggregation keys. */
|
|
16
|
+
const NON_GROUPABLE_DATE_FIELDS = new Set([
|
|
17
|
+
'publication_date',
|
|
18
|
+
'created_date',
|
|
19
|
+
'updated_date',
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* Whether a filter field is also a valid group_by target. group_by is a subset of filter:
|
|
23
|
+
* OpenAlex rejects (HTTP 400) the `*.search`/`*.search.exact` text operators, the `from_*`/`to_*`
|
|
24
|
+
* range-modifier directives, and the raw date fields — all valid as filters but not as aggregation
|
|
25
|
+
* keys. Integer count fields ARE groupable (bucketed) and are intentionally kept.
|
|
26
|
+
*/
|
|
27
|
+
function isGroupableField(field) {
|
|
28
|
+
if (field.endsWith('.search') || field.endsWith('.search.exact'))
|
|
29
|
+
return false;
|
|
30
|
+
if (field.startsWith('from_') || field.startsWith('to_'))
|
|
31
|
+
return false;
|
|
32
|
+
return !NON_GROUPABLE_DATE_FIELDS.has(field);
|
|
33
|
+
}
|
|
15
34
|
export const describeFieldsTool = tool('openalex_describe_fields', {
|
|
16
35
|
description: 'List valid field names for an OpenAlex entity type and context (filter, group_by, or select). Use proactively before constructing a filter or group_by to avoid invalid-field 400 errors. Pass `query` to narrow the results by name similarity — useful when you have a partial or guessed field name.',
|
|
17
36
|
sourceUrl: 'https://github.com/cyanheads/openalex-mcp-server/blob/main/src/mcp-server/tools/definitions/describe-fields.tool.ts',
|
|
@@ -20,7 +39,7 @@ export const describeFieldsTool = tool('openalex_describe_fields', {
|
|
|
20
39
|
entity_type: z.enum(ENTITY_TYPES).describe('OpenAlex entity type to list fields for.'),
|
|
21
40
|
context: z
|
|
22
41
|
.enum(CONTEXTS)
|
|
23
|
-
.describe('Field usage context. "filter": fields accepted in the filter param. "group_by": fields accepted in group_by
|
|
42
|
+
.describe('Field usage context. "filter": fields accepted in the filter param. "group_by": fields accepted in group_by — a subset of the filter set (raw date and *.search fields are excluded; they cannot be grouped). "select": fields accepted in select.'),
|
|
24
43
|
query: z
|
|
25
44
|
.string()
|
|
26
45
|
.optional()
|
|
@@ -37,7 +56,11 @@ export const describeFieldsTool = tool('openalex_describe_fields', {
|
|
|
37
56
|
handler(input, ctx) {
|
|
38
57
|
const catalog = getFieldCatalog();
|
|
39
58
|
const catalogContext = resolveContext(input.context);
|
|
40
|
-
const
|
|
59
|
+
const catalogPool = catalog[input.entity_type]?.[catalogContext] ?? [];
|
|
60
|
+
// group_by accepts only a subset of the filter fields — drop the ones OpenAlex rejects as
|
|
61
|
+
// aggregation keys so the tool never advertises a field analyze_trends will 400 on. filter
|
|
62
|
+
// and select keep the full set (dates / *.search / range-modifiers are valid there).
|
|
63
|
+
const pool = input.context === 'group_by' ? catalogPool.filter(isGroupableField) : catalogPool;
|
|
41
64
|
const fields = input.query ? rankFields(input.query, pool, 20) : pool;
|
|
42
65
|
ctx.log.info('Field catalog lookup', {
|
|
43
66
|
entityType: input.entity_type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe-fields.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/describe-fields.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,mFAAmF;AACnF,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAC;AAG3D
|
|
1
|
+
{"version":3,"file":"describe-fields.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/describe-fields.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,mFAAmF;AACnF,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAC;AAG3D,+FAA+F;AAC/F,SAAS,cAAc,CAAC,OAAqB;IAC3C,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;AACpD,CAAC;AAED,wGAAwG;AACxG,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC;IAC7D,kBAAkB;IAClB,cAAc;IACd,cAAc;CACf,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,KAAa;IACrC,IAAI,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,eAAe,CA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M,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,IAAI,GACR,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK;YACjC,CAAC,CAAC,qBAAqB,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,MAAM,CAAC,KAAK,kBAAkB;YAChF,CAAC,CAAC,EAAE,CAAC;QACT,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,IAAI,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC;IAClE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -6,14 +6,14 @@ import { z } from '@cyanheads/mcp-ts-core';
|
|
|
6
6
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
export declare const resolveNameTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
8
|
entity_type: z.ZodOptional<z.ZodEnum<{
|
|
9
|
-
works: "works";
|
|
10
9
|
authors: "authors";
|
|
11
|
-
|
|
10
|
+
funders: "funders";
|
|
12
11
|
institutions: "institutions";
|
|
13
|
-
topics: "topics";
|
|
14
12
|
keywords: "keywords";
|
|
15
13
|
publishers: "publishers";
|
|
16
|
-
|
|
14
|
+
sources: "sources";
|
|
15
|
+
topics: "topics";
|
|
16
|
+
works: "works";
|
|
17
17
|
}>>;
|
|
18
18
|
query: z.ZodString;
|
|
19
19
|
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -30,9 +30,15 @@ export declare const resolveNameTool: import("@cyanheads/mcp-ts-core").ToolDefin
|
|
|
30
30
|
}, z.core.$strip>, readonly [{
|
|
31
31
|
readonly reason: "rate_limited";
|
|
32
32
|
readonly code: JsonRpcErrorCode.RateLimited;
|
|
33
|
-
readonly when: "OpenAlex throttled the autocomplete request (HTTP 429).";
|
|
33
|
+
readonly when: "OpenAlex throttled the autocomplete request for exceeding its per-second ceiling (HTTP 429).";
|
|
34
34
|
readonly retryable: true;
|
|
35
35
|
readonly recovery: "Wait several seconds and retry; consider lowering request frequency for this caller.";
|
|
36
|
+
}, {
|
|
37
|
+
readonly reason: "upstream_budget_exhausted";
|
|
38
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
39
|
+
readonly when: "The OpenAlex daily usage budget is spent (HTTP 429).";
|
|
40
|
+
readonly retryable: false;
|
|
41
|
+
readonly recovery: "The daily budget refills at midnight UTC — retrying sooner will not succeed. Set OPENALEX_API_KEY to a free key (https://openalex.org/settings/api) for a larger daily budget than anonymous access, or wait for the reset.";
|
|
36
42
|
}, {
|
|
37
43
|
readonly reason: "upstream_timeout";
|
|
38
44
|
readonly code: JsonRpcErrorCode.Timeout;
|
|
@@ -42,7 +48,7 @@ export declare const resolveNameTool: import("@cyanheads/mcp-ts-core").ToolDefin
|
|
|
42
48
|
}, {
|
|
43
49
|
readonly reason: "upstream_unavailable";
|
|
44
50
|
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
45
|
-
readonly when: "OpenAlex
|
|
51
|
+
readonly when: "OpenAlex was unreachable or unusable — HTTP 503, a connection failure, or a body that was empty, HTML, or unparseable JSON.";
|
|
46
52
|
readonly retryable: true;
|
|
47
53
|
readonly recovery: "Wait and retry; check https://openalex.org for service status if the outage persists.";
|
|
48
54
|
}, {
|
|
@@ -55,11 +61,26 @@ export declare const resolveNameTool: import("@cyanheads/mcp-ts-core").ToolDefin
|
|
|
55
61
|
readonly code: JsonRpcErrorCode.Forbidden;
|
|
56
62
|
readonly when: "OpenAlex denied access to autocomplete (HTTP 403).";
|
|
57
63
|
readonly recovery: "Confirm the API key has access to autocomplete, then retry the request.";
|
|
64
|
+
}, {
|
|
65
|
+
readonly reason: "comma_in_filter_value";
|
|
66
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
67
|
+
readonly when: "A `filters` value contains a comma, which collides with the OpenAlex filter separator.";
|
|
68
|
+
readonly recovery: "Use `|` for OR within a filter value (e.g. \"2020|2021\"), or move a free-text phrase containing commas into the `query` parameter.";
|
|
58
69
|
}, {
|
|
59
70
|
readonly reason: "upstream_invalid_params";
|
|
60
|
-
readonly code: JsonRpcErrorCode.
|
|
61
|
-
readonly when: "OpenAlex rejected the autocomplete query
|
|
62
|
-
readonly recovery: "
|
|
71
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
72
|
+
readonly when: "OpenAlex rejected an invalid filter field name on the autocomplete query (HTTP 400).";
|
|
73
|
+
readonly recovery: "The upstream message names the rejected field and suggests close matches. Use openalex_describe_fields(entity_type, \"filter\") to browse valid filter fields, or drop `filters` entirely.";
|
|
74
|
+
}, {
|
|
75
|
+
readonly reason: "upstream_invalid_id_value";
|
|
76
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
77
|
+
readonly when: "A `filters` entry expecting an entity ID received a value that is not an OpenAlex ID — usually a name (HTTP 400).";
|
|
78
|
+
readonly recovery: "Resolve that name to an OpenAlex ID first — run this tool without the ID-valued filter, take the `id` from a match, then re-run with the ID.";
|
|
79
|
+
}, {
|
|
80
|
+
readonly reason: "upstream_invalid_params_other";
|
|
81
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
82
|
+
readonly when: "OpenAlex rejected the autocomplete request (HTTP 400) for a reason other than an invalid field name.";
|
|
83
|
+
readonly recovery: "Read the upstream message in the error above and adjust the request — trim the query, check filter value formats, and ensure entity_type is a supported value.";
|
|
63
84
|
}, {
|
|
64
85
|
readonly reason: "upstream_validation_failed";
|
|
65
86
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-name.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/resolve-name.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"resolve-name.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/resolve-name.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsM1B,CAAC"}
|
|
@@ -14,10 +14,17 @@ export const resolveNameTool = tool('openalex_resolve_name', {
|
|
|
14
14
|
{
|
|
15
15
|
reason: 'rate_limited',
|
|
16
16
|
code: JsonRpcErrorCode.RateLimited,
|
|
17
|
-
when: 'OpenAlex throttled the autocomplete request (HTTP 429).',
|
|
17
|
+
when: 'OpenAlex throttled the autocomplete request for exceeding its per-second ceiling (HTTP 429).',
|
|
18
18
|
retryable: true,
|
|
19
19
|
recovery: 'Wait several seconds and retry; consider lowering request frequency for this caller.',
|
|
20
20
|
},
|
|
21
|
+
{
|
|
22
|
+
reason: 'upstream_budget_exhausted',
|
|
23
|
+
code: JsonRpcErrorCode.RateLimited,
|
|
24
|
+
when: 'The OpenAlex daily usage budget is spent (HTTP 429).',
|
|
25
|
+
retryable: false,
|
|
26
|
+
recovery: 'The daily budget refills at midnight UTC — retrying sooner will not succeed. Set OPENALEX_API_KEY to a free key (https://openalex.org/settings/api) for a larger daily budget than anonymous access, or wait for the reset.',
|
|
27
|
+
},
|
|
21
28
|
{
|
|
22
29
|
reason: 'upstream_timeout',
|
|
23
30
|
code: JsonRpcErrorCode.Timeout,
|
|
@@ -28,7 +35,7 @@ export const resolveNameTool = tool('openalex_resolve_name', {
|
|
|
28
35
|
{
|
|
29
36
|
reason: 'upstream_unavailable',
|
|
30
37
|
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
31
|
-
when: 'OpenAlex
|
|
38
|
+
when: 'OpenAlex was unreachable or unusable — HTTP 503, a connection failure, or a body that was empty, HTML, or unparseable JSON.',
|
|
32
39
|
retryable: true,
|
|
33
40
|
recovery: 'Wait and retry; check https://openalex.org for service status if the outage persists.',
|
|
34
41
|
},
|
|
@@ -44,11 +51,29 @@ export const resolveNameTool = tool('openalex_resolve_name', {
|
|
|
44
51
|
when: 'OpenAlex denied access to autocomplete (HTTP 403).',
|
|
45
52
|
recovery: 'Confirm the API key has access to autocomplete, then retry the request.',
|
|
46
53
|
},
|
|
54
|
+
{
|
|
55
|
+
reason: 'comma_in_filter_value',
|
|
56
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
57
|
+
when: 'A `filters` value contains a comma, which collides with the OpenAlex filter separator.',
|
|
58
|
+
recovery: 'Use `|` for OR within a filter value (e.g. "2020|2021"), or move a free-text phrase containing commas into the `query` parameter.',
|
|
59
|
+
},
|
|
47
60
|
{
|
|
48
61
|
reason: 'upstream_invalid_params',
|
|
49
|
-
code: JsonRpcErrorCode.
|
|
50
|
-
when: 'OpenAlex rejected the autocomplete query
|
|
51
|
-
recovery: '
|
|
62
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
63
|
+
when: 'OpenAlex rejected an invalid filter field name on the autocomplete query (HTTP 400).',
|
|
64
|
+
recovery: 'The upstream message names the rejected field and suggests close matches. Use openalex_describe_fields(entity_type, "filter") to browse valid filter fields, or drop `filters` entirely.',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
reason: 'upstream_invalid_id_value',
|
|
68
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
69
|
+
when: 'A `filters` entry expecting an entity ID received a value that is not an OpenAlex ID — usually a name (HTTP 400).',
|
|
70
|
+
recovery: 'Resolve that name to an OpenAlex ID first — run this tool without the ID-valued filter, take the `id` from a match, then re-run with the ID.',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
reason: 'upstream_invalid_params_other',
|
|
74
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
75
|
+
when: 'OpenAlex rejected the autocomplete request (HTTP 400) for a reason other than an invalid field name.',
|
|
76
|
+
recovery: 'Read the upstream message in the error above and adjust the request — trim the query, check filter value formats, and ensure entity_type is a supported value.',
|
|
52
77
|
},
|
|
53
78
|
{
|
|
54
79
|
reason: 'upstream_validation_failed',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-name.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/resolve-name.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,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,uBAAuB,EAAE;IAC3D,WAAW,EACT,mOAAmO;IACrO,SAAS,EACP,kHAAkH;IACpH,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,MAAM,EAAE;QACN;YACE,MAAM,EAAE,cAAc;YACtB,IAAI,EAAE,gBAAgB,CAAC,WAAW;YAClC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"resolve-name.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/resolve-name.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,C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IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -6,20 +6,20 @@ import { z } from '@cyanheads/mcp-ts-core';
|
|
|
6
6
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
export declare const searchEntitiesTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
8
|
entity_type: z.ZodEnum<{
|
|
9
|
-
works: "works";
|
|
10
9
|
authors: "authors";
|
|
11
|
-
|
|
10
|
+
funders: "funders";
|
|
12
11
|
institutions: "institutions";
|
|
13
|
-
topics: "topics";
|
|
14
12
|
keywords: "keywords";
|
|
15
13
|
publishers: "publishers";
|
|
16
|
-
|
|
14
|
+
sources: "sources";
|
|
15
|
+
topics: "topics";
|
|
16
|
+
works: "works";
|
|
17
17
|
}>;
|
|
18
18
|
id: z.ZodOptional<z.ZodString>;
|
|
19
19
|
query: z.ZodOptional<z.ZodString>;
|
|
20
20
|
search_mode: z.ZodDefault<z.ZodEnum<{
|
|
21
|
-
keyword: "keyword";
|
|
22
21
|
exact: "exact";
|
|
22
|
+
keyword: "keyword";
|
|
23
23
|
semantic: "semantic";
|
|
24
24
|
}>>;
|
|
25
25
|
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -37,7 +37,7 @@ export declare const searchEntitiesTool: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
results: z.ZodArray<z.ZodObject<{
|
|
39
39
|
id: z.ZodString;
|
|
40
|
-
display_name: z.ZodString
|
|
40
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
41
41
|
}, z.core.$loose>>;
|
|
42
42
|
}, z.core.$strip>, readonly [{
|
|
43
43
|
readonly reason: "semantic_per_page_cap";
|
|
@@ -62,9 +62,15 @@ export declare const searchEntitiesTool: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
62
62
|
}, {
|
|
63
63
|
readonly reason: "rate_limited";
|
|
64
64
|
readonly code: JsonRpcErrorCode.RateLimited;
|
|
65
|
-
readonly when: "OpenAlex throttled the request (HTTP 429).";
|
|
65
|
+
readonly when: "OpenAlex throttled the request for exceeding its per-second ceiling (HTTP 429).";
|
|
66
66
|
readonly retryable: true;
|
|
67
67
|
readonly recovery: "Wait several seconds and retry; consider lowering request frequency for this caller.";
|
|
68
|
+
}, {
|
|
69
|
+
readonly reason: "upstream_budget_exhausted";
|
|
70
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
71
|
+
readonly when: "The OpenAlex daily usage budget is spent (HTTP 429).";
|
|
72
|
+
readonly retryable: false;
|
|
73
|
+
readonly recovery: "The daily budget refills at midnight UTC — retrying sooner will not succeed. Set OPENALEX_API_KEY to a free key (https://openalex.org/settings/api) for a larger daily budget than anonymous access, or wait for the reset.";
|
|
68
74
|
}, {
|
|
69
75
|
readonly reason: "upstream_timeout";
|
|
70
76
|
readonly code: JsonRpcErrorCode.Timeout;
|
|
@@ -74,7 +80,7 @@ export declare const searchEntitiesTool: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
74
80
|
}, {
|
|
75
81
|
readonly reason: "upstream_unavailable";
|
|
76
82
|
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
77
|
-
readonly when: "OpenAlex
|
|
83
|
+
readonly when: "OpenAlex was unreachable or unusable — HTTP 503, a connection failure, or a body that was empty, HTML, or unparseable JSON.";
|
|
78
84
|
readonly retryable: true;
|
|
79
85
|
readonly recovery: "Wait and retry; check https://openalex.org for service status if the outage persists.";
|
|
80
86
|
}, {
|
|
@@ -89,14 +95,29 @@ export declare const searchEntitiesTool: import("@cyanheads/mcp-ts-core").ToolDe
|
|
|
89
95
|
readonly recovery: "Confirm the API key has access to this entity type or endpoint, then retry the request.";
|
|
90
96
|
}, {
|
|
91
97
|
readonly reason: "comma_in_filter_value";
|
|
92
|
-
readonly code: JsonRpcErrorCode.
|
|
98
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
93
99
|
readonly when: "A filter value contains a comma, which collides with the OpenAlex filter separator.";
|
|
94
100
|
readonly 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.";
|
|
95
101
|
}, {
|
|
96
102
|
readonly reason: "upstream_invalid_params";
|
|
97
|
-
readonly code: JsonRpcErrorCode.
|
|
98
|
-
readonly when: "OpenAlex rejected
|
|
103
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
104
|
+
readonly when: "OpenAlex rejected an invalid filter, select, or sort field name (HTTP 400).";
|
|
99
105
|
readonly recovery: "The upstream message names the rejected field and suggests close matches. Use openalex_describe_fields(entity_type, context) to browse all valid fields for the given entity type and context.";
|
|
106
|
+
}, {
|
|
107
|
+
readonly reason: "upstream_invalid_id_value";
|
|
108
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
109
|
+
readonly when: "An entity-ID filter received a value that is not an OpenAlex ID — usually a name (HTTP 400).";
|
|
110
|
+
readonly recovery: "Call openalex_resolve_name to turn the name into an OpenAlex ID, then filter by that ID. Entity filters such as authorships.author.id, primary_topic.id, and cites accept IDs only.";
|
|
111
|
+
}, {
|
|
112
|
+
readonly reason: "upstream_sort_requires_search";
|
|
113
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
114
|
+
readonly when: "sort=-relevance_score was used without an active search (HTTP 400).";
|
|
115
|
+
readonly recovery: "Sorting by relevance_score requires an active search — add a `query` or a `*.search` filter (e.g. title.search), or choose a concrete sort field such as -cited_by_count or -publication_date.";
|
|
116
|
+
}, {
|
|
117
|
+
readonly reason: "upstream_invalid_params_other";
|
|
118
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
119
|
+
readonly when: "OpenAlex rejected the request (HTTP 400) for a reason other than an invalid field name.";
|
|
120
|
+
readonly recovery: "Read the upstream message in the error above and adjust the request — check filter operators, value formats, and cursor/per_page bounds.";
|
|
100
121
|
}, {
|
|
101
122
|
readonly reason: "upstream_validation_failed";
|
|
102
123
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-entities.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-entities.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiCjE,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"search-entities.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-entities.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiCjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+U7B,CAAC"}
|
|
@@ -61,10 +61,17 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
61
61
|
{
|
|
62
62
|
reason: 'rate_limited',
|
|
63
63
|
code: JsonRpcErrorCode.RateLimited,
|
|
64
|
-
when: 'OpenAlex throttled the request (HTTP 429).',
|
|
64
|
+
when: 'OpenAlex throttled the request for exceeding its per-second ceiling (HTTP 429).',
|
|
65
65
|
retryable: true,
|
|
66
66
|
recovery: 'Wait several seconds and retry; consider lowering request frequency for this caller.',
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
reason: 'upstream_budget_exhausted',
|
|
70
|
+
code: JsonRpcErrorCode.RateLimited,
|
|
71
|
+
when: 'The OpenAlex daily usage budget is spent (HTTP 429).',
|
|
72
|
+
retryable: false,
|
|
73
|
+
recovery: 'The daily budget refills at midnight UTC — retrying sooner will not succeed. Set OPENALEX_API_KEY to a free key (https://openalex.org/settings/api) for a larger daily budget than anonymous access, or wait for the reset.',
|
|
74
|
+
},
|
|
68
75
|
{
|
|
69
76
|
reason: 'upstream_timeout',
|
|
70
77
|
code: JsonRpcErrorCode.Timeout,
|
|
@@ -75,7 +82,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
75
82
|
{
|
|
76
83
|
reason: 'upstream_unavailable',
|
|
77
84
|
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
78
|
-
when: 'OpenAlex
|
|
85
|
+
when: 'OpenAlex was unreachable or unusable — HTTP 503, a connection failure, or a body that was empty, HTML, or unparseable JSON.',
|
|
79
86
|
retryable: true,
|
|
80
87
|
recovery: 'Wait and retry; check https://openalex.org for service status if the outage persists.',
|
|
81
88
|
},
|
|
@@ -93,16 +100,34 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
93
100
|
},
|
|
94
101
|
{
|
|
95
102
|
reason: 'comma_in_filter_value',
|
|
96
|
-
code: JsonRpcErrorCode.
|
|
103
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
97
104
|
when: 'A filter value contains a comma, which collides with the OpenAlex filter separator.',
|
|
98
105
|
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.',
|
|
99
106
|
},
|
|
100
107
|
{
|
|
101
108
|
reason: 'upstream_invalid_params',
|
|
102
|
-
code: JsonRpcErrorCode.
|
|
103
|
-
when: 'OpenAlex rejected
|
|
109
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
110
|
+
when: 'OpenAlex rejected an invalid filter, select, or sort field name (HTTP 400).',
|
|
104
111
|
recovery: 'The upstream message names the rejected field and suggests close matches. Use openalex_describe_fields(entity_type, context) to browse all valid fields for the given entity type and context.',
|
|
105
112
|
},
|
|
113
|
+
{
|
|
114
|
+
reason: 'upstream_invalid_id_value',
|
|
115
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
116
|
+
when: 'An entity-ID filter received a value that is not an OpenAlex ID — usually a name (HTTP 400).',
|
|
117
|
+
recovery: 'Call openalex_resolve_name to turn the name into an OpenAlex ID, then filter by that ID. Entity filters such as authorships.author.id, primary_topic.id, and cites accept IDs only.',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
reason: 'upstream_sort_requires_search',
|
|
121
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
122
|
+
when: 'sort=-relevance_score was used without an active search (HTTP 400).',
|
|
123
|
+
recovery: 'Sorting by relevance_score requires an active search — add a `query` or a `*.search` filter (e.g. title.search), or choose a concrete sort field such as -cited_by_count or -publication_date.',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
reason: 'upstream_invalid_params_other',
|
|
127
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
128
|
+
when: 'OpenAlex rejected the request (HTTP 400) for a reason other than an invalid field name.',
|
|
129
|
+
recovery: 'Read the upstream message in the error above and adjust the request — check filter operators, value formats, and cursor/per_page bounds.',
|
|
130
|
+
},
|
|
106
131
|
{
|
|
107
132
|
reason: 'upstream_validation_failed',
|
|
108
133
|
code: JsonRpcErrorCode.ValidationError,
|
|
@@ -131,7 +156,7 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
131
156
|
sort: z
|
|
132
157
|
.string()
|
|
133
158
|
.optional()
|
|
134
|
-
.describe('Sort field. Prefix with "-" for descending. Common: "cited_by_count", "-publication_date", "-relevance_score" (default when query present). Note: when combined with a keyword query, an explicit sort overrides relevance ranking entirely — top results may be highly cited but only tangentially on-topic. Use "-relevance_score" or omit sort to keep the most relevant results first. "-relevance_score" requires an active search via "query" or a "filter:search" filter — passing it without one will fail.'),
|
|
159
|
+
.describe('Sort field. Prefix with "-" for descending. Comma-separate for a multi-key sort, applied left to right, with the "-" prefix set per key ("-publication_year,cited_by_count" sorts by year descending, then citations ascending). Common: "cited_by_count", "-publication_date", "-relevance_score" (default when query present). Note: when combined with a keyword query, an explicit sort overrides relevance ranking entirely — top results may be highly cited but only tangentially on-topic. Use "-relevance_score" or omit sort to keep the most relevant results first. "-relevance_score" requires an active search via "query" or a "filter:search" filter — passing it without one will fail.'),
|
|
135
160
|
select: z
|
|
136
161
|
.array(z.string())
|
|
137
162
|
.optional()
|
|
@@ -174,10 +199,13 @@ export const searchEntitiesTool = tool('openalex_search_entities', {
|
|
|
174
199
|
.array(z
|
|
175
200
|
.object({
|
|
176
201
|
id: z.string().describe('OpenAlex ID (e.g., "W2741809807", "A1234567890").'),
|
|
177
|
-
display_name: z
|
|
202
|
+
display_name: z
|
|
203
|
+
.string()
|
|
204
|
+
.nullable()
|
|
205
|
+
.describe('Entity name or work title. null when OpenAlex holds no title for the record (paratext works and other untitled entries) — use `id` to identify it.'),
|
|
178
206
|
})
|
|
179
207
|
.passthrough()
|
|
180
|
-
.describe('A single OpenAlex entity record.
|
|
208
|
+
.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`.'))
|
|
181
209
|
.describe('OpenAlex entity objects passed through unchanged. Additional fields depend on entity_type and select.'),
|
|
182
210
|
}),
|
|
183
211
|
// Agent-facing context for the success path — the query/filters as parsed, the
|
|
@@ -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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KAAK,CAAC,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,0BAA0B,EAAE;IACjE,WAAW,EACT,+iBAA+iB;IACjjB,SAAS,EACP,qHAAqH;IACvH,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,MAAM,EAAE;QACN;YACE,MAAM,EAAE,uBAAuB;YAC/B,IAAI,EAAE,gBAAgB,CAAC,eAAe;YACtC,IAAI,EAAE,+CAA+C,qBAAqB,GAAG;YAC7E,QAAQ,EAAE,sBAAsB,qBAAqB,6CAA6C;SACnG;QACD;YACE,MAAM,EAAE,oBAAoB;YAC5B,IAAI,EAAE,gBAAgB,CAAC,eAAe;YACtC,IAAI,EAAE,2CAA2C;YACjD,QAAQ,EAAE,0EAA0E;SACrF;QACD;YACE,MAAM,EAAE,qBAAqB;YAC7B,IAAI,EAAE,gBAAgB,CAAC,eAAe;YACtC,IAAI,EAAE,uCAAuC;YAC7C,QAAQ,EAAE,4DAA4D;SACvE;QACD;YACE,MAAM,EAAE,kBAAkB;YAC1B,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,IAAI,EAAE,0CAA0C;YAChD,QAAQ,EAAE,4EAA4E;SACvF;QACD;YACE,MAAM,EAAE,cAAc;YACtB,IAAI,EAAE,gBAAgB,CAAC,WAAW;YAClC,IAAI,EAAE,
|
|
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,+BA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AO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QACjB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,MAAM,UAAU,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,gBAAgB,MAAM,CAAC,IAAI,CAAC,QAAQ,WAAW,CAAC;QACvF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW;YACpC,CAAC,CAAC,KAAK,UAAU,uBAAuB,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI;YACnE,CAAC,CAAC,KAAK,UAAU,IAAI,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEnB,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACpD,CAAC;QAED,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,MAAsB,CAAC,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -34,7 +34,9 @@ export declare function initOpenAlexService(): void;
|
|
|
34
34
|
export declare function getOpenAlexService(): OpenAlexService;
|
|
35
35
|
/**
|
|
36
36
|
* Return the typed field catalog keyed by entity type → context → field list.
|
|
37
|
-
* `
|
|
37
|
+
* Only `filter` and `select` arrays are stored. `group_by` resolves to the `filter` key here;
|
|
38
|
+
* the describe-fields handler then prunes the fields group_by cannot target (raw dates,
|
|
39
|
+
* `*.search` operators, and `from_*`/`to_*` range modifiers).
|
|
38
40
|
*/
|
|
39
41
|
export declare function getFieldCatalog(): Record<EntityType, {
|
|
40
42
|
filter: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openalex-service.d.ts","sourceRoot":"","sources":["../../../src/services/openalex/openalex-service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAsBtD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAIvB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAsDpB;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CA6C9C;
|
|
1
|
+
{"version":3,"file":"openalex-service.d.ts","sourceRoot":"","sources":["../../../src/services/openalex/openalex-service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAsBtD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAIvB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAsDpB;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CA6C9C;AA8gBD,cAAM,eAAe;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,cAKC;IAED,yFAAyF;IACzF,OAAO,CAAC,OAAO;IAyCf,OAAO,CAAC,2BAA2B;IAoEnC,OAAO,CAAC,aAAa;IAqCrB,sEAAsE;IA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