paper-search-cli 0.3.1 → 0.3.2
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/README.md +1 -1
- package/README.zh.md +1 -1
- package/dist/capabilities/body-snippet-search/handler.d.ts +9 -0
- package/dist/capabilities/body-snippet-search/handler.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/handler.js +17 -0
- package/dist/capabilities/body-snippet-search/handler.js.map +1 -0
- package/dist/capabilities/body-snippet-search/index.d.ts +7 -0
- package/dist/capabilities/body-snippet-search/index.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/index.js +6 -0
- package/dist/capabilities/body-snippet-search/index.js.map +1 -0
- package/dist/capabilities/body-snippet-search/schemas.d.ts +36 -0
- package/dist/capabilities/body-snippet-search/schemas.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/schemas.js +16 -0
- package/dist/capabilities/body-snippet-search/schemas.js.map +1 -0
- package/dist/capabilities/body-snippet-search/service.d.ts +4 -0
- package/dist/capabilities/body-snippet-search/service.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/service.js +4 -0
- package/dist/capabilities/body-snippet-search/service.js.map +1 -0
- package/dist/capabilities/body-snippet-search/tools.d.ts +187 -0
- package/dist/capabilities/body-snippet-search/tools.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/tools.js +49 -0
- package/dist/capabilities/body-snippet-search/tools.js.map +1 -0
- package/dist/capabilities/body-snippet-search/types.d.ts +14 -0
- package/dist/capabilities/body-snippet-search/types.d.ts.map +1 -0
- package/dist/capabilities/body-snippet-search/types.js +2 -0
- package/dist/capabilities/body-snippet-search/types.js.map +1 -0
- package/dist/capabilities/citation-expansion/CitationService.d.ts +47 -0
- package/dist/capabilities/citation-expansion/CitationService.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/CitationService.js +243 -0
- package/dist/capabilities/citation-expansion/CitationService.js.map +1 -0
- package/dist/capabilities/citation-expansion/handler.d.ts +36 -0
- package/dist/capabilities/citation-expansion/handler.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/handler.js +44 -0
- package/dist/capabilities/citation-expansion/handler.js.map +1 -0
- package/dist/capabilities/citation-expansion/index.d.ts +6 -0
- package/dist/capabilities/citation-expansion/index.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/index.js +5 -0
- package/dist/capabilities/citation-expansion/index.js.map +1 -0
- package/dist/capabilities/citation-expansion/schemas.d.ts +28 -0
- package/dist/capabilities/citation-expansion/schemas.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/schemas.js +13 -0
- package/dist/capabilities/citation-expansion/schemas.js.map +1 -0
- package/dist/capabilities/citation-expansion/tools.d.ts +82 -0
- package/dist/capabilities/citation-expansion/tools.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/tools.js +48 -0
- package/dist/capabilities/citation-expansion/tools.js.map +1 -0
- package/dist/capabilities/citation-expansion/types.d.ts +22 -0
- package/dist/capabilities/citation-expansion/types.d.ts.map +1 -0
- package/dist/capabilities/citation-expansion/types.js +2 -0
- package/dist/capabilities/citation-expansion/types.js.map +1 -0
- package/dist/capabilities/journal-metrics/JournalMetricsService.d.ts +3 -0
- package/dist/capabilities/journal-metrics/JournalMetricsService.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/JournalMetricsService.js +142 -0
- package/dist/capabilities/journal-metrics/JournalMetricsService.js.map +1 -0
- package/dist/capabilities/journal-metrics/handler.d.ts +12 -0
- package/dist/capabilities/journal-metrics/handler.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/handler.js +38 -0
- package/dist/capabilities/journal-metrics/handler.js.map +1 -0
- package/dist/capabilities/journal-metrics/index.d.ts +6 -0
- package/dist/capabilities/journal-metrics/index.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/index.js +5 -0
- package/dist/capabilities/journal-metrics/index.js.map +1 -0
- package/dist/capabilities/journal-metrics/schemas.d.ts +28 -0
- package/dist/capabilities/journal-metrics/schemas.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/schemas.js +13 -0
- package/dist/capabilities/journal-metrics/schemas.js.map +1 -0
- package/dist/capabilities/journal-metrics/tools.d.ts +67 -0
- package/dist/capabilities/journal-metrics/tools.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/tools.js +27 -0
- package/dist/capabilities/journal-metrics/tools.js.map +1 -0
- package/dist/capabilities/journal-metrics/types.d.ts +36 -0
- package/dist/capabilities/journal-metrics/types.d.ts.map +1 -0
- package/dist/capabilities/journal-metrics/types.js +2 -0
- package/dist/capabilities/journal-metrics/types.js.map +1 -0
- package/dist/capabilities/metadata-search/MultiSourceSearchService.d.ts +9 -0
- package/dist/capabilities/metadata-search/MultiSourceSearchService.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/MultiSourceSearchService.js +78 -0
- package/dist/capabilities/metadata-search/MultiSourceSearchService.js.map +1 -0
- package/dist/capabilities/metadata-search/handler.d.ts +23 -0
- package/dist/capabilities/metadata-search/handler.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/handler.js +163 -0
- package/dist/capabilities/metadata-search/handler.js.map +1 -0
- package/dist/capabilities/metadata-search/index.d.ts +6 -0
- package/dist/capabilities/metadata-search/index.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/index.js +5 -0
- package/dist/capabilities/metadata-search/index.js.map +1 -0
- package/dist/capabilities/metadata-search/schemas.d.ts +83 -0
- package/dist/capabilities/metadata-search/schemas.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/schemas.js +81 -0
- package/dist/capabilities/metadata-search/schemas.js.map +1 -0
- package/dist/capabilities/metadata-search/tools.d.ts +178 -0
- package/dist/capabilities/metadata-search/tools.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/tools.js +75 -0
- package/dist/capabilities/metadata-search/tools.js.map +1 -0
- package/dist/capabilities/metadata-search/types.d.ts +13 -0
- package/dist/capabilities/metadata-search/types.d.ts.map +1 -0
- package/dist/capabilities/metadata-search/types.js +2 -0
- package/dist/capabilities/metadata-search/types.js.map +1 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.d.ts +22 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.js +2 -0
- package/dist/capabilities/pdf-discovery/DownloadTier.js.map +1 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.d.ts +10 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js +53 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js.map +1 -0
- package/dist/capabilities/pdf-discovery/handler.d.ts +19 -0
- package/dist/capabilities/pdf-discovery/handler.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/handler.js +56 -0
- package/dist/capabilities/pdf-discovery/handler.js.map +1 -0
- package/dist/capabilities/pdf-discovery/index.d.ts +7 -0
- package/dist/capabilities/pdf-discovery/index.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/index.js +5 -0
- package/dist/capabilities/pdf-discovery/index.js.map +1 -0
- package/dist/capabilities/pdf-discovery/schemas.d.ts +37 -0
- package/dist/capabilities/pdf-discovery/schemas.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/schemas.js +22 -0
- package/dist/capabilities/pdf-discovery/schemas.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.js +27 -0
- package/dist/capabilities/pdf-discovery/tiers/directPdfUrl.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/primary.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/primary.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/primary.js +21 -0
- package/dist/capabilities/pdf-discovery/tiers/primary.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/repositories.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/repositories.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/repositories.js +35 -0
- package/dist/capabilities/pdf-discovery/tiers/repositories.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/scihub.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/scihub.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/scihub.js +21 -0
- package/dist/capabilities/pdf-discovery/tiers/scihub.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.js +29 -0
- package/dist/capabilities/pdf-discovery/tiers/unpaywall.js.map +1 -0
- package/dist/capabilities/pdf-discovery/tools.d.ts +114 -0
- package/dist/capabilities/pdf-discovery/tools.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/tools.js +42 -0
- package/dist/capabilities/pdf-discovery/tools.js.map +1 -0
- package/dist/capabilities/pdf-discovery/types.d.ts +19 -0
- package/dist/capabilities/pdf-discovery/types.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/types.js +2 -0
- package/dist/capabilities/pdf-discovery/types.js.map +1 -0
- package/dist/cli.js +6 -6
- package/dist/cli.js.map +1 -1
- package/dist/core/capabilityProfile.d.ts +1 -17
- package/dist/core/capabilityProfile.d.ts.map +1 -1
- package/dist/core/capabilityProfile.js +1 -166
- package/dist/core/capabilityProfile.js.map +1 -1
- package/dist/core/diagnostics.d.ts +1 -42
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/diagnostics.js +1 -585
- package/dist/core/diagnostics.js.map +1 -1
- package/dist/core/handleToolCall.d.ts +1 -0
- package/dist/core/handleToolCall.d.ts.map +1 -1
- package/dist/core/handleToolCall.js +265 -509
- package/dist/core/handleToolCall.js.map +1 -1
- package/dist/core/httpPolicies.d.ts +2 -0
- package/dist/core/httpPolicies.d.ts.map +1 -0
- package/dist/core/httpPolicies.js +2 -0
- package/dist/core/httpPolicies.js.map +1 -0
- package/dist/core/liveSmoke.d.ts +1 -41
- package/dist/core/liveSmoke.d.ts.map +1 -1
- package/dist/core/liveSmoke.js +1 -225
- package/dist/core/liveSmoke.js.map +1 -1
- package/dist/core/platformFactories.d.ts +2 -0
- package/dist/core/platformFactories.d.ts.map +1 -0
- package/dist/core/platformFactories.js +2 -0
- package/dist/core/platformFactories.js.map +1 -0
- package/dist/core/platformMetadata.d.ts +1 -27
- package/dist/core/platformMetadata.d.ts.map +1 -1
- package/dist/core/platformMetadata.js +1 -257
- package/dist/core/platformMetadata.js.map +1 -1
- package/dist/core/schemas.d.ts +10 -202
- package/dist/core/schemas.d.ts.map +1 -1
- package/dist/core/schemas.js +11 -118
- package/dist/core/schemas.js.map +1 -1
- package/dist/core/searchers.d.ts +24 -24
- package/dist/core/searchers.d.ts.map +1 -1
- package/dist/core/searchers.js +14 -79
- package/dist/core/searchers.js.map +1 -1
- package/dist/core/textReports.d.ts +1 -20
- package/dist/core/textReports.d.ts.map +1 -1
- package/dist/core/textReports.js +1 -84
- package/dist/core/textReports.js.map +1 -1
- package/dist/core/tools.d.ts.map +1 -1
- package/dist/core/tools.js +15 -237
- package/dist/core/tools.js.map +1 -1
- package/dist/infrastructure/cache/RequestCache.d.ts +26 -0
- package/dist/infrastructure/cache/RequestCache.d.ts.map +1 -0
- package/dist/infrastructure/cache/RequestCache.js +66 -0
- package/dist/infrastructure/cache/RequestCache.js.map +1 -0
- package/dist/infrastructure/http/ErrorHandler.d.ts +99 -0
- package/dist/infrastructure/http/ErrorHandler.d.ts.map +1 -0
- package/dist/infrastructure/http/ErrorHandler.js +266 -0
- package/dist/infrastructure/http/ErrorHandler.js.map +1 -0
- package/dist/infrastructure/http/HttpClient.d.ts +31 -0
- package/dist/infrastructure/http/HttpClient.d.ts.map +1 -0
- package/dist/infrastructure/http/HttpClient.js +50 -0
- package/dist/infrastructure/http/HttpClient.js.map +1 -0
- package/dist/infrastructure/pdf/PDFExtractor.d.ts +34 -0
- package/dist/infrastructure/pdf/PDFExtractor.d.ts.map +1 -0
- package/dist/infrastructure/pdf/PDFExtractor.js +130 -0
- package/dist/infrastructure/pdf/PDFExtractor.js.map +1 -0
- package/dist/infrastructure/pdf/PdfDownload.d.ts +7 -0
- package/dist/infrastructure/pdf/PdfDownload.d.ts.map +1 -0
- package/dist/infrastructure/pdf/PdfDownload.js +175 -0
- package/dist/infrastructure/pdf/PdfDownload.js.map +1 -0
- package/dist/infrastructure/rate-limit/RateLimiter.d.ts +50 -0
- package/dist/infrastructure/rate-limit/RateLimiter.d.ts.map +1 -0
- package/dist/infrastructure/rate-limit/RateLimiter.js +128 -0
- package/dist/infrastructure/rate-limit/RateLimiter.js.map +1 -0
- package/dist/infrastructure/security/SecurityUtils.d.ts +80 -0
- package/dist/infrastructure/security/SecurityUtils.d.ts.map +1 -0
- package/dist/infrastructure/security/SecurityUtils.js +357 -0
- package/dist/infrastructure/security/SecurityUtils.js.map +1 -0
- package/dist/management/capability-profile/index.d.ts +18 -0
- package/dist/management/capability-profile/index.d.ts.map +1 -0
- package/dist/management/capability-profile/index.js +167 -0
- package/dist/management/capability-profile/index.js.map +1 -0
- package/dist/management/config/index.d.ts +2 -0
- package/dist/management/config/index.d.ts.map +1 -0
- package/dist/management/config/index.js +2 -0
- package/dist/management/config/index.js.map +1 -0
- package/dist/management/diagnostics/index.d.ts +43 -0
- package/dist/management/diagnostics/index.d.ts.map +1 -0
- package/dist/management/diagnostics/index.js +586 -0
- package/dist/management/diagnostics/index.js.map +1 -0
- package/dist/management/reports/index.d.ts +21 -0
- package/dist/management/reports/index.d.ts.map +1 -0
- package/dist/management/reports/index.js +85 -0
- package/dist/management/reports/index.js.map +1 -0
- package/dist/management/skills/index.d.ts +2 -0
- package/dist/management/skills/index.d.ts.map +1 -0
- package/dist/management/skills/index.js +2 -0
- package/dist/management/skills/index.js.map +1 -0
- package/dist/management/smoke/index.d.ts +42 -0
- package/dist/management/smoke/index.d.ts.map +1 -0
- package/dist/management/smoke/index.js +226 -0
- package/dist/management/smoke/index.js.map +1 -0
- package/dist/registry/aliases.d.ts +2 -0
- package/dist/registry/aliases.d.ts.map +1 -0
- package/dist/registry/aliases.js +2 -0
- package/dist/registry/aliases.js.map +1 -0
- package/dist/registry/httpPolicies.d.ts +3 -0
- package/dist/registry/httpPolicies.d.ts.map +1 -0
- package/dist/registry/httpPolicies.js +17 -0
- package/dist/registry/httpPolicies.js.map +1 -0
- package/dist/registry/platformFactories.d.ts +8 -0
- package/dist/registry/platformFactories.d.ts.map +1 -0
- package/dist/registry/platformFactories.js +55 -0
- package/dist/registry/platformFactories.js.map +1 -0
- package/dist/registry/platformMetadata.d.ts +39 -0
- package/dist/registry/platformMetadata.d.ts.map +1 -0
- package/dist/registry/platformMetadata.js +321 -0
- package/dist/registry/platformMetadata.js.map +1 -0
- package/dist/services/CitationService.d.ts +2 -65
- package/dist/services/CitationService.d.ts.map +1 -1
- package/dist/services/CitationService.js +1 -242
- package/dist/services/CitationService.js.map +1 -1
- package/dist/services/JournalMetricsService.d.ts +2 -37
- package/dist/services/JournalMetricsService.d.ts.map +1 -1
- package/dist/services/JournalMetricsService.js +1 -141
- package/dist/services/JournalMetricsService.js.map +1 -1
- package/dist/services/MultiSourceSearchService.d.ts +2 -18
- package/dist/services/MultiSourceSearchService.d.ts.map +1 -1
- package/dist/services/MultiSourceSearchService.js +1 -77
- package/dist/services/MultiSourceSearchService.js.map +1 -1
- package/dist/services/OpenAccessFallbackService.d.ts +3 -40
- package/dist/services/OpenAccessFallbackService.d.ts.map +1 -1
- package/dist/services/OpenAccessFallbackService.js +1 -146
- package/dist/services/OpenAccessFallbackService.js.map +1 -1
- package/dist/utils/ErrorHandler.d.ts +2 -98
- package/dist/utils/ErrorHandler.d.ts.map +1 -1
- package/dist/utils/ErrorHandler.js +2 -265
- package/dist/utils/ErrorHandler.js.map +1 -1
- package/dist/utils/HttpClient.d.ts +1 -5
- package/dist/utils/HttpClient.d.ts.map +1 -1
- package/dist/utils/HttpClient.js +1 -29
- package/dist/utils/HttpClient.js.map +1 -1
- package/dist/utils/PDFExtractor.d.ts +2 -33
- package/dist/utils/PDFExtractor.d.ts.map +1 -1
- package/dist/utils/PDFExtractor.js +2 -129
- package/dist/utils/PDFExtractor.js.map +1 -1
- package/dist/utils/PdfDownload.d.ts +1 -6
- package/dist/utils/PdfDownload.d.ts.map +1 -1
- package/dist/utils/PdfDownload.js +1 -141
- package/dist/utils/PdfDownload.js.map +1 -1
- package/dist/utils/RateLimiter.d.ts +1 -49
- package/dist/utils/RateLimiter.d.ts.map +1 -1
- package/dist/utils/RateLimiter.js +1 -127
- package/dist/utils/RateLimiter.js.map +1 -1
- package/dist/utils/RequestCache.d.ts +2 -25
- package/dist/utils/RequestCache.d.ts.map +1 -1
- package/dist/utils/RequestCache.js +2 -65
- package/dist/utils/RequestCache.js.map +1 -1
- package/dist/utils/SecurityUtils.d.ts +2 -79
- package/dist/utils/SecurityUtils.d.ts.map +1 -1
- package/dist/utils/SecurityUtils.js +2 -356
- package/dist/utils/SecurityUtils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { TIMEOUTS } from '../../config/constants.js';
|
|
2
|
+
import { PaperFactory } from '../../models/Paper.js';
|
|
3
|
+
import { logDebug } from '../../utils/Logger.js';
|
|
4
|
+
import { withTimeout } from '../../utils/SecurityUtils.js';
|
|
5
|
+
import { getPlatformMetadata, resolvePlatformId } from '../../core/platformMetadata.js';
|
|
6
|
+
import { searchMultipleSources } from './MultiSourceSearchService.js';
|
|
7
|
+
const DOI_LOOKUP_SOURCES = [
|
|
8
|
+
'crossref',
|
|
9
|
+
'openalex',
|
|
10
|
+
'unpaywall',
|
|
11
|
+
'pubmed',
|
|
12
|
+
'pmc',
|
|
13
|
+
'europepmc',
|
|
14
|
+
'core',
|
|
15
|
+
'webofscience',
|
|
16
|
+
'arxiv'
|
|
17
|
+
];
|
|
18
|
+
function jsonTextResponse(text) {
|
|
19
|
+
return {
|
|
20
|
+
content: [
|
|
21
|
+
{
|
|
22
|
+
type: 'text',
|
|
23
|
+
text
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function normalizeDoi(value) {
|
|
29
|
+
return value
|
|
30
|
+
.trim()
|
|
31
|
+
.replace(/^https?:\/\/(?:dx\.)?doi\.org\//i, '')
|
|
32
|
+
.toLowerCase();
|
|
33
|
+
}
|
|
34
|
+
function paperMatchesDoi(paper, doi) {
|
|
35
|
+
return normalizeDoi(paper.doi || '') === normalizeDoi(doi);
|
|
36
|
+
}
|
|
37
|
+
export async function handleGenericSearch(platform, args, searchers) {
|
|
38
|
+
const resolvedPlatform = resolvePlatformId(platform);
|
|
39
|
+
const searcher = searchers[resolvedPlatform];
|
|
40
|
+
if (!searcher) {
|
|
41
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
42
|
+
}
|
|
43
|
+
const { query, ...searchOptions } = args;
|
|
44
|
+
const results = await searcher.search(query, searchOptions);
|
|
45
|
+
const displayName = getPlatformMetadata(platform)?.displayName || platform;
|
|
46
|
+
return jsonTextResponse(`Found ${results.length} ${displayName} papers.\n\n${JSON.stringify(results.map((paper) => PaperFactory.toDict(paper)), null, 2)}`);
|
|
47
|
+
}
|
|
48
|
+
export async function handleSearchPapers(args, searchers) {
|
|
49
|
+
const { query, platform, sources, maxResults, year, author, journal, category, days, fetchDetails, fieldsOfStudy, sortBy, sortOrder } = args;
|
|
50
|
+
const results = [];
|
|
51
|
+
const searchOptions = {
|
|
52
|
+
maxResults,
|
|
53
|
+
year,
|
|
54
|
+
author,
|
|
55
|
+
journal,
|
|
56
|
+
category,
|
|
57
|
+
days,
|
|
58
|
+
fetchDetails,
|
|
59
|
+
fieldsOfStudy,
|
|
60
|
+
sortBy,
|
|
61
|
+
sortOrder
|
|
62
|
+
};
|
|
63
|
+
if (platform === 'all') {
|
|
64
|
+
const result = await searchMultipleSources(searchers, query, sources || 'all', searchOptions);
|
|
65
|
+
return jsonTextResponse(`Found ${result.total} papers across ${result.sources_used.length} source(s).\n\n${JSON.stringify(result, null, 2)}`);
|
|
66
|
+
}
|
|
67
|
+
else if (sources) {
|
|
68
|
+
const result = await searchMultipleSources(searchers, query, sources, searchOptions);
|
|
69
|
+
return jsonTextResponse(`Found ${result.total} papers across ${result.sources_used.length} source(s).\n\n${JSON.stringify(result, null, 2)}`);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const resolvedPlatform = resolvePlatformId(platform);
|
|
73
|
+
const searcher = searchers[resolvedPlatform];
|
|
74
|
+
if (!searcher) {
|
|
75
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
76
|
+
}
|
|
77
|
+
const platformResults = await searcher.search(query, searchOptions);
|
|
78
|
+
results.push(...platformResults.map((paper) => PaperFactory.toDict(paper)));
|
|
79
|
+
}
|
|
80
|
+
return jsonTextResponse(`Found ${results.length} papers.\n\n${JSON.stringify(results, null, 2)}`);
|
|
81
|
+
}
|
|
82
|
+
export async function handleGetPaperByDoi(args, searchers) {
|
|
83
|
+
const { doi, platform } = args;
|
|
84
|
+
const results = [];
|
|
85
|
+
const sourceResults = {};
|
|
86
|
+
const errors = {};
|
|
87
|
+
const failedSources = [];
|
|
88
|
+
if (platform === 'all') {
|
|
89
|
+
const selected = DOI_LOOKUP_SOURCES.filter(source => source in searchers);
|
|
90
|
+
const settled = await Promise.allSettled(selected.map(async (source) => {
|
|
91
|
+
const searcher = searchers[source];
|
|
92
|
+
const paper = await withTimeout(searcher.getPaperByDoi(doi), TIMEOUTS.SOURCE_TASK, `${source} DOI lookup timed out after ${TIMEOUTS.SOURCE_TASK}ms`);
|
|
93
|
+
return { source, paper };
|
|
94
|
+
}));
|
|
95
|
+
for (let i = 0; i < settled.length; i += 1) {
|
|
96
|
+
const source = selected[i];
|
|
97
|
+
const result = settled[i];
|
|
98
|
+
if (result.status === 'rejected') {
|
|
99
|
+
sourceResults[source] = 0;
|
|
100
|
+
errors[source] = result.reason?.message || String(result.reason);
|
|
101
|
+
failedSources.push(source);
|
|
102
|
+
logDebug(`Error getting paper by DOI from ${source}:`, result.reason);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const paper = result.value.paper;
|
|
106
|
+
if (!paper) {
|
|
107
|
+
sourceResults[source] = 0;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (!paperMatchesDoi(paper, doi)) {
|
|
111
|
+
sourceResults[source] = 0;
|
|
112
|
+
errors[source] = `Returned DOI ${paper.doi || '(missing)'} did not match requested DOI ${doi}`;
|
|
113
|
+
failedSources.push(source);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
sourceResults[source] = 1;
|
|
117
|
+
results.push(PaperFactory.toDict(paper));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
const searcher = searchers[resolvePlatformId(platform)];
|
|
122
|
+
if (!searcher) {
|
|
123
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
124
|
+
}
|
|
125
|
+
const paper = await searcher.getPaperByDoi(doi);
|
|
126
|
+
if (paper) {
|
|
127
|
+
results.push(PaperFactory.toDict(paper));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (results.length === 0) {
|
|
131
|
+
if (platform === 'all') {
|
|
132
|
+
const result = {
|
|
133
|
+
doi,
|
|
134
|
+
sources_requested: 'all',
|
|
135
|
+
sources_used: DOI_LOOKUP_SOURCES.filter(source => source in searchers),
|
|
136
|
+
source_results: sourceResults,
|
|
137
|
+
errors,
|
|
138
|
+
failed_sources: failedSources,
|
|
139
|
+
warnings: failedSources.map(source => `${source}: ${errors[source]}`),
|
|
140
|
+
total: 0,
|
|
141
|
+
papers: []
|
|
142
|
+
};
|
|
143
|
+
return jsonTextResponse(`No paper found with DOI: ${doi}\n\n${JSON.stringify(result, null, 2)}`);
|
|
144
|
+
}
|
|
145
|
+
return jsonTextResponse(`No paper found with DOI: ${doi}`);
|
|
146
|
+
}
|
|
147
|
+
if (platform === 'all') {
|
|
148
|
+
const result = {
|
|
149
|
+
doi,
|
|
150
|
+
sources_requested: 'all',
|
|
151
|
+
sources_used: DOI_LOOKUP_SOURCES.filter(source => source in searchers),
|
|
152
|
+
source_results: sourceResults,
|
|
153
|
+
errors,
|
|
154
|
+
failed_sources: failedSources,
|
|
155
|
+
warnings: failedSources.map(source => `${source}: ${errors[source]}`),
|
|
156
|
+
total: results.length,
|
|
157
|
+
papers: results
|
|
158
|
+
};
|
|
159
|
+
return jsonTextResponse(`Found ${results.length} paper(s) with DOI ${doi} across ${result.sources_used.length} source(s).\n\n${JSON.stringify(result, null, 2)}`);
|
|
160
|
+
}
|
|
161
|
+
return jsonTextResponse(`Found ${results.length} paper(s) with DOI ${doi}:\n\n${JSON.stringify(results, null, 2)}`);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAc,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,kBAAkB,GAAG;IACzB,UAAU;IACV,UAAU;IACV,WAAW;IACX,QAAQ;IACR,KAAK;IACL,WAAW;IACX,MAAM;IACN,cAAc;IACd,OAAO;CACC,CAAC;AAEX,SAAS,gBAAgB,CAAC,IAAY;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BAAiB,EAAE,KAAK;YACxB,YAAY,EAAE,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,IAAI,SAAS,CAAC;YACtE,cAAc,EAAE,aAAa;YAC7B,MAAM;YACN,cAAc,EAAE,aAAa;YAC7B,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACrE,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,MAAM,EAAE,OAAO;SAChB,CAAC;QACF,OAAO,gBAAgB,CAAC,SAAS,OAAO,CAAC,MAAM,sBAAsB,GAAG,WAAW,MAAM,CAAC,YAAY,CAAC,MAAM,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACpK,CAAC;IACD,OAAO,gBAAgB,CAAC,SAAS,OAAO,CAAC,MAAM,sBAAsB,GAAG,QAAQ,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AACtH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { dedupePapers, parseSourceList, searchMultipleSources } from './MultiSourceSearchService.js';
|
|
2
|
+
export { handleGenericSearch, handleGetPaperByDoi, handleSearchPapers } from './handler.js';
|
|
3
|
+
export { GetPaperByDoiSchema, SearchPapersSchema } from './schemas.js';
|
|
4
|
+
export { GET_PAPER_BY_DOI_TOOL, METADATA_SEARCH_TOOLS, SEARCH_PAPERS_TOOL } from './tools.js';
|
|
5
|
+
export type { MultiSourceSearchResult } from './types.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE9F,YAAY,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { dedupePapers, parseSourceList, searchMultipleSources } from './MultiSourceSearchService.js';
|
|
2
|
+
export { handleGenericSearch, handleGetPaperByDoi, handleSearchPapers } from './handler.js';
|
|
3
|
+
export { GetPaperByDoiSchema, SearchPapersSchema } from './schemas.js';
|
|
4
|
+
export { GET_PAPER_BY_DOI_TOOL, METADATA_SEARCH_TOOLS, SEARCH_PAPERS_TOOL } from './tools.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,qBAAqB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SearchPapersSchema: z.ZodEffects<z.ZodObject<{
|
|
3
|
+
query: z.ZodString;
|
|
4
|
+
platform: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<"all">]>>>;
|
|
5
|
+
sources: z.ZodOptional<z.ZodString>;
|
|
6
|
+
maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7
|
+
year: z.ZodOptional<z.ZodString>;
|
|
8
|
+
author: z.ZodOptional<z.ZodString>;
|
|
9
|
+
journal: z.ZodOptional<z.ZodString>;
|
|
10
|
+
category: z.ZodOptional<z.ZodString>;
|
|
11
|
+
days: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
fetchDetails: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
fieldsOfStudy: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
sortBy: z.ZodDefault<z.ZodOptional<z.ZodEnum<["relevance", "date", "citations"]>>>;
|
|
15
|
+
sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
maxResults: number;
|
|
18
|
+
sortBy: "relevance" | "date" | "citations";
|
|
19
|
+
sortOrder: "asc" | "desc";
|
|
20
|
+
query: string;
|
|
21
|
+
platform: string;
|
|
22
|
+
journal?: string | undefined;
|
|
23
|
+
year?: string | undefined;
|
|
24
|
+
author?: string | undefined;
|
|
25
|
+
category?: string | undefined;
|
|
26
|
+
days?: number | undefined;
|
|
27
|
+
fetchDetails?: boolean | undefined;
|
|
28
|
+
fieldsOfStudy?: string[] | undefined;
|
|
29
|
+
sources?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
query: string;
|
|
32
|
+
journal?: string | undefined;
|
|
33
|
+
year?: string | undefined;
|
|
34
|
+
maxResults?: number | undefined;
|
|
35
|
+
author?: string | undefined;
|
|
36
|
+
category?: string | undefined;
|
|
37
|
+
sortBy?: "relevance" | "date" | "citations" | undefined;
|
|
38
|
+
sortOrder?: "asc" | "desc" | undefined;
|
|
39
|
+
days?: number | undefined;
|
|
40
|
+
fetchDetails?: boolean | undefined;
|
|
41
|
+
fieldsOfStudy?: string[] | undefined;
|
|
42
|
+
platform?: string | undefined;
|
|
43
|
+
sources?: string | undefined;
|
|
44
|
+
}>, {
|
|
45
|
+
maxResults: number;
|
|
46
|
+
sortBy: "relevance" | "date" | "citations";
|
|
47
|
+
sortOrder: "asc" | "desc";
|
|
48
|
+
query: string;
|
|
49
|
+
platform: string;
|
|
50
|
+
journal?: string | undefined;
|
|
51
|
+
year?: string | undefined;
|
|
52
|
+
author?: string | undefined;
|
|
53
|
+
category?: string | undefined;
|
|
54
|
+
days?: number | undefined;
|
|
55
|
+
fetchDetails?: boolean | undefined;
|
|
56
|
+
fieldsOfStudy?: string[] | undefined;
|
|
57
|
+
sources?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
query: string;
|
|
60
|
+
journal?: string | undefined;
|
|
61
|
+
year?: string | undefined;
|
|
62
|
+
maxResults?: number | undefined;
|
|
63
|
+
author?: string | undefined;
|
|
64
|
+
category?: string | undefined;
|
|
65
|
+
sortBy?: "relevance" | "date" | "citations" | undefined;
|
|
66
|
+
sortOrder?: "asc" | "desc" | undefined;
|
|
67
|
+
days?: number | undefined;
|
|
68
|
+
fetchDetails?: boolean | undefined;
|
|
69
|
+
fieldsOfStudy?: string[] | undefined;
|
|
70
|
+
platform?: string | undefined;
|
|
71
|
+
sources?: string | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
export declare const GetPaperByDoiSchema: z.ZodObject<{
|
|
74
|
+
doi: z.ZodString;
|
|
75
|
+
platform: z.ZodDefault<z.ZodOptional<z.ZodEnum<["arxiv", "webofscience", "pubmed", "crossref", "openalex", "unpaywall", "pmc", "europepmc", "core", "all"]>>>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
doi: string;
|
|
78
|
+
platform: "arxiv" | "webofscience" | "pubmed" | "core" | "crossref" | "openalex" | "unpaywall" | "pmc" | "europepmc" | "all";
|
|
79
|
+
}, {
|
|
80
|
+
doi: string;
|
|
81
|
+
platform?: "arxiv" | "webofscience" | "pubmed" | "core" | "crossref" | "openalex" | "unpaywall" | "pmc" | "europepmc" | "all" | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmC3B,CAAC;AAEL,eAAO,MAAM,mBAAmB;;;;;;;;;EAmBtB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HARD_CORE_MAX_RESULTS_CAP, getCoreMaxResultsCap } from '../../config/ResultCaps.js';
|
|
3
|
+
import { isKnownSearchPlatform } from '../../core/platformMetadata.js';
|
|
4
|
+
const SortBySchema = z.enum(['relevance', 'date', 'citations']);
|
|
5
|
+
const SortOrderSchema = z.enum(['asc', 'desc']);
|
|
6
|
+
const SearchPlatformSchema = z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.refine(value => value === 'all' || isKnownSearchPlatform(value), {
|
|
10
|
+
message: 'Unsupported search platform'
|
|
11
|
+
});
|
|
12
|
+
function assertCoreMaxResults(value, ctx) {
|
|
13
|
+
const cap = getCoreMaxResultsCap();
|
|
14
|
+
if (value > cap) {
|
|
15
|
+
ctx.addIssue({
|
|
16
|
+
code: z.ZodIssueCode.too_big,
|
|
17
|
+
maximum: cap,
|
|
18
|
+
type: 'number',
|
|
19
|
+
inclusive: true,
|
|
20
|
+
message: `Number must be less than or equal to ${cap}`,
|
|
21
|
+
path: ['maxResults']
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export const SearchPapersSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
query: z.string().min(1),
|
|
28
|
+
platform: z
|
|
29
|
+
.union([SearchPlatformSchema, z.literal('all')])
|
|
30
|
+
.optional()
|
|
31
|
+
.default('crossref'),
|
|
32
|
+
sources: z.string().optional(),
|
|
33
|
+
maxResults: z.number().int().min(1).max(HARD_CORE_MAX_RESULTS_CAP).optional().default(10),
|
|
34
|
+
year: z.string().optional(),
|
|
35
|
+
author: z.string().optional(),
|
|
36
|
+
journal: z.string().optional(),
|
|
37
|
+
category: z.string().optional(),
|
|
38
|
+
days: z.number().int().min(1).max(3650).optional(),
|
|
39
|
+
fetchDetails: z.boolean().optional(),
|
|
40
|
+
fieldsOfStudy: z.array(z.string()).optional(),
|
|
41
|
+
sortBy: SortBySchema.optional().default('relevance'),
|
|
42
|
+
sortOrder: SortOrderSchema.optional().default('desc')
|
|
43
|
+
})
|
|
44
|
+
.strip()
|
|
45
|
+
.superRefine((value, ctx) => {
|
|
46
|
+
if (!value.sources && value.platform === 'core') {
|
|
47
|
+
assertCoreMaxResults(value.maxResults, ctx);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (value.maxResults > 100) {
|
|
51
|
+
ctx.addIssue({
|
|
52
|
+
code: z.ZodIssueCode.too_big,
|
|
53
|
+
maximum: 100,
|
|
54
|
+
type: 'number',
|
|
55
|
+
inclusive: true,
|
|
56
|
+
message: 'Number must be less than or equal to 100',
|
|
57
|
+
path: ['maxResults']
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export const GetPaperByDoiSchema = z
|
|
62
|
+
.object({
|
|
63
|
+
doi: z.coerce.string().min(1),
|
|
64
|
+
platform: z
|
|
65
|
+
.enum([
|
|
66
|
+
'arxiv',
|
|
67
|
+
'webofscience',
|
|
68
|
+
'pubmed',
|
|
69
|
+
'crossref',
|
|
70
|
+
'openalex',
|
|
71
|
+
'unpaywall',
|
|
72
|
+
'pmc',
|
|
73
|
+
'europepmc',
|
|
74
|
+
'core',
|
|
75
|
+
'all'
|
|
76
|
+
])
|
|
77
|
+
.optional()
|
|
78
|
+
.default('all')
|
|
79
|
+
})
|
|
80
|
+
.strip();
|
|
81
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAChE,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAChD,MAAM,oBAAoB,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,KAAK,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE;IAChE,OAAO,EAAE,6BAA6B;CACvC,CAAC,CAAC;AAEL,SAAS,oBAAoB,CAAC,KAAa,EAAE,GAAoB;IAC/D,MAAM,GAAG,GAAG,oBAAoB,EAAE,CAAC;IACnC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QAChB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,OAAO;YAC5B,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,wCAAwC,GAAG,EAAE;YACtD,IAAI,EAAE,CAAC,Y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,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;CACtD,CAAC;KACD,KAAK,EAAE;KACP,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QAChD,oBAAoB,CAAC,KAAK,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC5C,OAAO;IACT,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC;QAC3B,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,OAAO;YAC5B,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,0CAA0C;YACnD,IAAI,EAAE,CAAC,YAAY,CAAC;SACrB,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,QAAQ,EAAE,CAAC;SACR,IAAI,CAAC;QACJ,OAAO;QACP,cAAc;QACd,QAAQ;QACR,UAAU;QACV,UAAU;QACV,WAAW;QACX,KAAK;QACL,WAAW;QACX,MAAM;QACN,KAAK;KACN,CAAC;SACD,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;CAClB,CAAC;KACD,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export declare const SEARCH_PAPERS_TOOL: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: string;
|
|
6
|
+
properties: {
|
|
7
|
+
query: {
|
|
8
|
+
type: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
platform: {
|
|
12
|
+
type: string;
|
|
13
|
+
enum: string[];
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
sources: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
maxResults: {
|
|
21
|
+
type: string;
|
|
22
|
+
minimum: number;
|
|
23
|
+
maximum: number;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
year: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
author: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
journal: {
|
|
35
|
+
type: string;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
category: {
|
|
39
|
+
type: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
days: {
|
|
43
|
+
type: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
fetchDetails: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
fieldsOfStudy: {
|
|
51
|
+
type: string;
|
|
52
|
+
items: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
sortBy: {
|
|
58
|
+
type: string;
|
|
59
|
+
enum: string[];
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
sortOrder: {
|
|
63
|
+
type: string;
|
|
64
|
+
enum: string[];
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
required: string[];
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export declare const GET_PAPER_BY_DOI_TOOL: {
|
|
72
|
+
name: string;
|
|
73
|
+
description: string;
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: string;
|
|
76
|
+
properties: {
|
|
77
|
+
doi: {
|
|
78
|
+
type: string;
|
|
79
|
+
description: string;
|
|
80
|
+
};
|
|
81
|
+
platform: {
|
|
82
|
+
type: string;
|
|
83
|
+
enum: string[];
|
|
84
|
+
description: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
required: string[];
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export declare const METADATA_SEARCH_TOOLS: ({
|
|
91
|
+
name: string;
|
|
92
|
+
description: string;
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: string;
|
|
95
|
+
properties: {
|
|
96
|
+
query: {
|
|
97
|
+
type: string;
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
platform: {
|
|
101
|
+
type: string;
|
|
102
|
+
enum: string[];
|
|
103
|
+
description: string;
|
|
104
|
+
};
|
|
105
|
+
sources: {
|
|
106
|
+
type: string;
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
maxResults: {
|
|
110
|
+
type: string;
|
|
111
|
+
minimum: number;
|
|
112
|
+
maximum: number;
|
|
113
|
+
description: string;
|
|
114
|
+
};
|
|
115
|
+
year: {
|
|
116
|
+
type: string;
|
|
117
|
+
description: string;
|
|
118
|
+
};
|
|
119
|
+
author: {
|
|
120
|
+
type: string;
|
|
121
|
+
description: string;
|
|
122
|
+
};
|
|
123
|
+
journal: {
|
|
124
|
+
type: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
category: {
|
|
128
|
+
type: string;
|
|
129
|
+
description: string;
|
|
130
|
+
};
|
|
131
|
+
days: {
|
|
132
|
+
type: string;
|
|
133
|
+
description: string;
|
|
134
|
+
};
|
|
135
|
+
fetchDetails: {
|
|
136
|
+
type: string;
|
|
137
|
+
description: string;
|
|
138
|
+
};
|
|
139
|
+
fieldsOfStudy: {
|
|
140
|
+
type: string;
|
|
141
|
+
items: {
|
|
142
|
+
type: string;
|
|
143
|
+
};
|
|
144
|
+
description: string;
|
|
145
|
+
};
|
|
146
|
+
sortBy: {
|
|
147
|
+
type: string;
|
|
148
|
+
enum: string[];
|
|
149
|
+
description: string;
|
|
150
|
+
};
|
|
151
|
+
sortOrder: {
|
|
152
|
+
type: string;
|
|
153
|
+
enum: string[];
|
|
154
|
+
description: string;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
required: string[];
|
|
158
|
+
};
|
|
159
|
+
} | {
|
|
160
|
+
name: string;
|
|
161
|
+
description: string;
|
|
162
|
+
inputSchema: {
|
|
163
|
+
type: string;
|
|
164
|
+
properties: {
|
|
165
|
+
doi: {
|
|
166
|
+
type: string;
|
|
167
|
+
description: string;
|
|
168
|
+
};
|
|
169
|
+
platform: {
|
|
170
|
+
type: string;
|
|
171
|
+
enum: string[];
|
|
172
|
+
description: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
required: string[];
|
|
176
|
+
};
|
|
177
|
+
})[];
|
|
178
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/tools.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsD9B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;CAkBjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA8C,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { SEARCH_PLATFORM_VALUES } from '../../core/platformMetadata.js';
|
|
2
|
+
export const SEARCH_PAPERS_TOOL = {
|
|
3
|
+
name: 'search_papers',
|
|
4
|
+
description: 'Search academic papers from multiple sources including arXiv, Web of Science, etc.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
query: { type: 'string', description: 'Search query string' },
|
|
9
|
+
platform: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
enum: [...SEARCH_PLATFORM_VALUES, 'all'],
|
|
12
|
+
description: 'Platform to search (default: crossref). Use --sources for comma-separated multi-source search. Note: Wiley only supports PDF download by DOI.'
|
|
13
|
+
},
|
|
14
|
+
sources: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Comma-separated source list for multi-source search, or all for every registered search source except DOI-download-only providers. Failed or unconfigured sources are reported in failed_sources/errors. Example: crossref,openalex,pubmed,pmc'
|
|
17
|
+
},
|
|
18
|
+
maxResults: {
|
|
19
|
+
type: 'number',
|
|
20
|
+
minimum: 1,
|
|
21
|
+
maximum: 100,
|
|
22
|
+
description: 'Maximum number of results to return'
|
|
23
|
+
},
|
|
24
|
+
year: { type: 'string', description: 'Year filter (e.g., "2023", "2020-2023", "2020-")' },
|
|
25
|
+
author: { type: 'string', description: 'Author name filter' },
|
|
26
|
+
journal: { type: 'string', description: 'Journal name filter' },
|
|
27
|
+
category: { type: 'string', description: 'Category filter (e.g., cs.AI for arXiv)' },
|
|
28
|
+
days: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
description: 'Number of days to search back (bioRxiv/medRxiv only)'
|
|
31
|
+
},
|
|
32
|
+
fetchDetails: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
description: 'Fetch detailed information (IACR only)'
|
|
35
|
+
},
|
|
36
|
+
fieldsOfStudy: {
|
|
37
|
+
type: 'array',
|
|
38
|
+
items: { type: 'string' },
|
|
39
|
+
description: 'Fields of study filter (Semantic Scholar only)'
|
|
40
|
+
},
|
|
41
|
+
sortBy: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
enum: ['relevance', 'date', 'citations'],
|
|
44
|
+
description: 'Sort results by relevance, date, or citations'
|
|
45
|
+
},
|
|
46
|
+
sortOrder: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
enum: ['asc', 'desc'],
|
|
49
|
+
description: 'Sort order: ascending or descending'
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
required: ['query']
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export const GET_PAPER_BY_DOI_TOOL = {
|
|
56
|
+
name: 'get_paper_by_doi',
|
|
57
|
+
description: 'Retrieve paper information using DOI from available platforms',
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
properties: {
|
|
61
|
+
doi: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'DOI (Digital Object Identifier)'
|
|
64
|
+
},
|
|
65
|
+
platform: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
enum: ['arxiv', 'webofscience', 'pubmed', 'crossref', 'openalex', 'unpaywall', 'pmc', 'europepmc', 'core', 'all'],
|
|
68
|
+
description: 'Platform to search'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
required: ['doi']
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export const METADATA_SEARCH_TOOLS = [SEARCH_PAPERS_TOOL, GET_PAPER_BY_DOI_TOOL];
|
|
75
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,oFAAoF;IACjG,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE;YAC7D,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,GAAG,sBAAsB,EAAE,KAAK,CAAC;gBACx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EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,GAAG,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC;gBACjH,WAAW,EAAE,oBAAoB;aAClC;SACF;QACD,QAAQ,EAAE,CAAC,KAAK,CAAC;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface MultiSourceSearchResult {
|
|
2
|
+
query: string;
|
|
3
|
+
sources_requested: string;
|
|
4
|
+
sources_used: string[];
|
|
5
|
+
source_results: Record<string, number>;
|
|
6
|
+
errors: Record<string, string>;
|
|
7
|
+
failed_sources: string[];
|
|
8
|
+
warnings: string[];
|
|
9
|
+
total: number;
|
|
10
|
+
raw_total: number;
|
|
11
|
+
papers: Record<string, unknown>[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/capabilities/metadata-search/types.ts"],"names":[],"mappings":""}
|