Skip to main content
Glama

get_similar_articles

Retrieve articles related to a given PubMed ID by analyzing content similarity to discover relevant biomedical literature.

Instructions

Find related articles based on content similarity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pmidYesPubMed ID
max_resultsNoMaximum similar articles (default: 20)

Implementation Reference

  • The handler function handleGetSimilarArticles that executes the 'get_similar_articles' tool logic. It extracts pmid and max_results from args, validates the PMID, calls eutilsClient.getSimilarArticles(), and returns the results as JSON text content.
    async function handleGetSimilarArticles(args: any) {
      const { pmid, max_results = 20 } = args;
    
      if (!isValidPMID(pmid)) {
        throw new Error(`Invalid PMID format: ${pmid}`);
      }
    
      const similarPmids = await eutilsClient.getSimilarArticles(pmid, max_results);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              pmid,
              similarArticles: similarPmids
            }, null, 2)
          }
        ]
      };
    }
  • The input schema for the 'get_similar_articles' tool, defining 'pmid' (required string) and 'max_results' (optional number, default 20, min 1, max 100) as input properties.
    {
      name: 'get_similar_articles',
      description: 'Find related articles based on content similarity',
      inputSchema: {
        type: 'object',
        properties: {
          pmid: {
            type: 'string',
            description: 'PubMed ID'
          },
          max_results: {
            type: 'number',
            description: 'Maximum similar articles (default: 20)',
            minimum: 1,
            maximum: 100
          }
        },
        required: ['pmid']
      }
    },
  • src/index.ts:476-477 (registration)
    The case statement in the tool dispatcher that routes 'get_similar_articles' requests to the handleGetSimilarArticles function.
    case 'get_similar_articles':
      return await handleGetSimilarArticles(args);
  • src/index.ts:354-373 (registration)
    The tool definition/registration entry in the tools array, listing 'get_similar_articles' with its name, description, and inputSchema.
    {
      name: 'get_similar_articles',
      description: 'Find related articles based on content similarity',
      inputSchema: {
        type: 'object',
        properties: {
          pmid: {
            type: 'string',
            description: 'PubMed ID'
          },
          max_results: {
            type: 'number',
            description: 'Maximum similar articles (default: 20)',
            minimum: 1,
            maximum: 100
          }
        },
        required: ['pmid']
      }
    },
  • The getSimilarArticles method on the EutilsClient class that queries PubMed's elink API with neighbor_score command to find similar articles by PMID, returning an array of PMID strings up to maxResults.
    async getSimilarArticles(pmid: string, maxResults: number = 20): Promise<string[]> {
      const result = await this.link({
        dbfrom: 'pubmed',
        db: 'pubmed',
        id: pmid,
        cmd: 'neighbor_score'
      });
    
      const linkSet = result.eLinkResult?.LinkSet;
      if (!linkSet) {
        return [];
      }
    
      const linkSetDb = linkSet.LinkSetDb;
      if (!linkSetDb) {
        return [];
      }
    
      const links = linkSetDb.Link;
      if (!links) {
        return [];
      }
    
      const linkArray = Array.isArray(links) ? links : [links];
      return linkArray
        .slice(0, maxResults)
        .map((link: any) => extractText(link.Id));
    }
Behavior2/5

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

No annotations provided, and description lacks details about behavior (e.g., algorithmic basis, limitations, authentication needs). Only states 'based on content similarity' without further disclosure.

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?

Single sentence is concise and front-loaded. However, it may be too brief for sufficient information, but not overly verbose.

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?

Description lacks information about return format, pagination, rate limits, or any additional constraints. Given no output schema and no annotations, the description is incomplete for a tool with two parameters.

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?

Input schema covers 100% of parameters with clear names and descriptions. The description adds no extra meaning beyond the schema, so baseline score of 3 is appropriate.

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?

Description clearly states 'Find related articles based on content similarity', which is a specific verb+resource. It distinguishes from sibling tools like search_articles (query-based) and get_article_details (single 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 Guidelines2/5

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

No guidance on when to use this tool versus alternatives such as search_articles or get_cited_by. The description does not provide context for optimal usage.

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