sch_get
Retrieve scholarly research data by providing a DOI, arXiv ID, or URL. Integrates with TOOL4LM for enhanced local LLM capabilities, enabling efficient academic information access and document reading.
Instructions
Alias of sch.get
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arxivId | No | ||
| doi | No | ||
| url | No |
Implementation Reference
- src/tools/scholar.ts:79-105 (handler)The schGet function implements the core logic for retrieving scholarly article metadata by DOI (via Crossref), arXiv ID (via arXiv search), or URL (extracts DOI). This is the handler executed by the 'sch_get' tool.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:184-189 (registration)MCP server registration for the 'sch_get' tool. It defines the tool name, description, input shape, and handler that wraps schGet and formats the response.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) }] }; }
- src/server.ts:176-176 (schema)Zod schema defining the input parameters for the sch_get tool (and sch.get): optional doi, arxivId, or url.const schGetShape = { doi: z.string().optional(), arxivId: z.string().optional(), url: z.string().optional() };
- src/server.ts:177-182 (registration)Primary MCP server registration for the 'sch.get' tool, of which 'sch_get' is an alias. Same handler and schema.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) }] }; }