Skip to main content
Glama
ncukondo

PubMed MCP Server

by ncukondo

fetch_summary

Retrieve detailed article information from PubMed by providing PMIDs to access scientific research data.

Instructions

Fetch detailed article information from PubMed using PMIDs.

Input Schema

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

Implementation Reference

  • Core handler factory for fetch_summary tool. Creates an object with fetchSummary method that retrieves article summaries from PubMed API.
    export function createFetchSummaryHandler(pubmedOptions: PubMedOptions) { const pubmedApi = createPubMedAPI(pubmedOptions); return { async fetchSummary(pmids: string[]): Promise<Article[]> { return await pubmedApi.fetchArticles(pmids); } }; }
  • Input schema for the fetch_summary tool defining pmids as array of strings.
    inputSchema: { pmids: z.array(z.string()).describe('Array of PubMed IDs (PMIDs) to fetch') }
  • src/index.ts:177-208 (registration)
    Registers the 'fetch_summary' MCP tool with title, description, input schema, and execution handler that delegates to fetchSummaryHandler and formats the JSON 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'}`, }, ], }; } } );
  • Instantiates the fetchSummaryHandler using PubMed options for use in tool registration and resource handler.
    const fetchSummaryHandler = createFetchSummaryHandler(pubmedOptions);

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