Skip to main content
Glama
ncukondo

PubMed MCP Server

by ncukondo

fetch_summary

Retrieve detailed scientific article information from PubMed using PMIDs to access research data efficiently.

Instructions

Fetch detailed article information from PubMed using PMIDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pmidsYesArray of PubMed IDs (PMIDs) to fetch

Implementation Reference

  • Factory function that creates the fetchSummary handler. The handler fetches PubMed articles by PMIDs using the PubMed API.
    export function createFetchSummaryHandler(pubmedOptions: PubMedOptions) { const pubmedApi = createPubMedAPI(pubmedOptions); return { async fetchSummary(pmids: string[]): Promise<Article[]> { return await pubmedApi.fetchArticles(pmids); } }; }
  • src/index.ts:160-190 (registration)
    Registration of the 'fetch_summary' tool with MCP server, including title, description, input schema, and the wrapper handler function that calls the core fetchSummary and formats the response.
    server.registerTool( 'fetch_summary', { title: 'PubMed Article Summary', description: 'Fetch detailed article information from PubMed using PMIDs.', inputSchema: { pmids: z.array(z.string()).describe('Array of PubMed IDs (PMIDs) to fetch') } }, async ({ pmids }) => { try { const results = await fetchSummaryHandler.fetchSummary(pmids); return { content: [ { type: 'text', text: JSON.stringify(results, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching article summaries: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }
  • Zod input schema defining the expected input: an array of PMIDs (strings).
    inputSchema: { pmids: z.array(z.string()).describe('Array of PubMed IDs (PMIDs) to fetch') }
  • Configuration of PubMed options and creation of the fetchSummaryHandler instance passed to the tool registration.
    const pubmedOptions = { email, ...(apiKey && { apiKey }), ...(cacheDir && { cacheDir }), ...(cacheTTL && { cacheTTL: parseInt(cacheTTL) }) }; const searchHandler = createSearchHandler(pubmedOptions); const fetchSummaryHandler = createFetchSummaryHandler(pubmedOptions);

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ncukondo/pubmed-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server