Skip to main content
Glama

batch_article_lookup

Retrieve up to 200 biomedical article citations in a single batch using provided PubMed IDs.

Instructions

Retrieve multiple articles efficiently (up to 200 PMIDs)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pmidsYesArray of PubMed IDs

Implementation Reference

  • Handler function for batch_article_lookup. Validates input (non-empty array, max 200 PMIDs, valid PMID format), processes in chunks of 50 via eutilsClient.getArticlesBatch, and returns articles with counts.
    async function handleBatchArticleLookup(args: any) {
      const { pmids } = args;
    
      if (!Array.isArray(pmids) || pmids.length === 0) {
        throw new Error('pmids must be a non-empty array');
      }
    
      if (pmids.length > 200) {
        throw new Error('Maximum 200 PMIDs allowed per batch');
      }
    
      // Validate all PMIDs
      for (const pmid of pmids) {
        if (!isValidPMID(pmid)) {
          throw new Error(`Invalid PMID format: ${pmid}`);
        }
      }
    
      // Process in chunks of 50
      const chunks = chunkArray(pmids, 50);
      const allArticles = [];
    
      for (const chunk of chunks) {
        const articles = await eutilsClient.getArticlesBatch(chunk);
        allArticles.push(...articles);
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              totalRequested: pmids.length,
              totalRetrieved: allArticles.length,
              articles: allArticles
            }, null, 2)
          }
        ]
      };
    }
  • Tool schema/definition registered in ListToolsRequestSchema handler. Defines the input schema requiring a 'pmids' array of strings (max 200 items).
    {
      name: 'batch_article_lookup',
      description: 'Retrieve multiple articles efficiently (up to 200 PMIDs)',
      inputSchema: {
        type: 'object',
        properties: {
          pmids: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of PubMed IDs',
            maxItems: 200
          }
        },
        required: ['pmids']
      }
  • src/index.ts:467-468 (registration)
    Tool execution registration in CallToolRequestSchema handler. Routes the tool name 'batch_article_lookup' to the handleBatchArticleLookup function.
    case 'batch_article_lookup':
      return await handleBatchArticleLookup(args);
  • Helper method on EUtilsClient that fetches multiple articles by PMIDs from NCBI E-utilities, parses XML response, and returns PubMedArticle objects.
    async getArticlesBatch(pmids: string[]): Promise<PubMedArticle[]> {
      if (pmids.length === 0) {
        return [];
      }
    
      const result = await this.fetch({
        db: 'pubmed',
        id: pmids,
        retmode: 'xml',
        rettype: 'abstract'
      });
    
      const articleSet = result.PubmedArticleSet?.PubmedArticle || result.PubmedArticle;
      if (!articleSet) {
        return [];
      }
    
      const articles = Array.isArray(articleSet) ? articleSet : [articleSet];
      return articles.map(article => this.parseArticle(article));
    }
  • Generic utility function that splits an array into smaller chunks of a given size. Used by handleBatchArticleLookup to process PMIDs in chunks of 50.
    export function chunkArray<T>(array: T[], size: number): T[][] {
      const chunks: T[][] = [];
      for (let i = 0; i < array.length; i += size) {
        chunks.push(array.slice(i, i + size));
      }
      return chunks;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description lacks behavioral details such as read-only nature, error handling, output format, or side effects. The word 'efficiently' is vague.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise at one sentence, but could include more context about the output or constraints. It is not verbose, yet slightly under-specified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given multiple sibling tools and no output schema, the description does not specify what is returned (e.g., article metadata), error behavior, or prerequisites. Incomplete for an agent to use effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema fully describes the pmids parameter (array, max 200), and the description repeats that limit but adds no additional meaning. Baseline 3 is appropriate given 100% schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Retrieve' and resource 'multiple articles', and specifies the batch limit of 200 PMIDs, distinguishing it from single-article tools like get_article_details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description hints at batch efficiency but does not explicitly state when to use this tool versus alternatives like get_article_details or search_articles. Usage context is implied but not clearly defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/Augmented-Nature/PubMed-MCP-Server'

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