sch.get
Retrieve scholarly metadata for academic papers using DOI, arXiv ID, or URL to access publication details and research information.
Instructions
Get scholarly metadata by DOI/arXivId/URL.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doi | No | ||
| arxivId | No | ||
| url | No |
Implementation Reference
- src/tools/scholar.ts:79-105 (handler)Core handler function schGet that implements the scholarly metadata retrieval logic using Crossref API for DOI, arXiv search for arxivId, and DOI extraction from URL regex.export async function schGet(args: { doi?: string, arxivId?: string, url?: string }) { if (args.doi) { const url = `https://api.crossref.org/works/${encodeURIComponent(args.doi)}`; const res = await fetchWithLimits(url, 8000, 1024*1024); if (res.body) { const it = JSON.parse(res.body.toString('utf-8')).message; return { title: (it.title && it.title[0]) || '', authors: (it.author || []).map((a:any) => [a.given, a.family].filter(Boolean).join(' ')), year: (it.created?.['date-parts']?.[0]?.[0]) || '', doi: it.DOI || '', url: it.URL || '', abstract: (it.abstract || '').replace(/<[^>]+>/g, ''), source: 'crossref' }; } } if (args.arxivId) { const items = await arxivSearch(`id:${args.arxivId}`, 1); return items[0] || null; } if (args.url) { const m = args.url.match(/10\.\d{4,9}\/[-._;()/:A-Z0-9]+/i); if (m) return schGet({ doi: m[0] }); } return null; }
- src/server.ts:176-176 (schema)Zod input schema for sch.get tool matching the schGet function parameters.const schGetShape = { doi: z.string().optional(), arxivId: z.string().optional(), url: z.string().optional() };
- src/server.ts:177-183 (registration)MCP server registration of the 'sch.get' tool, with thin inline handler that calls schGet and formats response.server.tool('sch.get', 'Get scholarly metadata by DOI/arXivId/URL.', schGetShape, OPEN, async ({ doi, arxivId, url }) => { const res = await schGet({ doi, arxivId, url }); return { content: [{ type: 'text', text: JSON.stringify(res) }] }; } );
- src/server.ts:184-189 (registration)Registration of alias 'sch_get' for the sch.get tool.server.tool('sch_get', 'Alias of sch.get', schGetShape, OPEN, async ({ doi, arxivId, url }) => { const res = await schGet({ doi, arxivId, url }); return { content: [{ type: 'text', text: JSON.stringify(res) }] }; }