Skip to main content
Glama

validate_pmid

Verifies PubMed ID format and confirms the existence of the associated article in PubMed.

Instructions

Validate PubMed ID format and check if article exists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pmidYesPubMed ID to validate

Implementation Reference

  • Main handler function for validate_pmid tool. Validates PMID format via isValidPMID, then checks if the article exists via eutilsClient.getArticleDetails. Returns JSON with valid/exists status and message.
    async function handleValidatePMID(args: any) {
      const { pmid } = args;
    
      const valid = isValidPMID(pmid);
    
      if (!valid) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                valid: false,
                pmid,
                message: 'Invalid PMID format. PMID must contain only digits.'
              }, null, 2)
            }
          ]
        };
      }
    
      // Check if article exists
      try {
        await eutilsClient.getArticleDetails(pmid);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                valid: true,
                pmid,
                exists: true,
                message: 'Valid PMID and article exists'
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                valid: true,
                pmid,
                exists: false,
                message: 'Valid PMID format but article not found'
              }, null, 2)
            }
          ]
        };
      }
    }
  • Input schema definition for validate_pmid tool. Defines 'pmid' as a required string property.
    // Validation & Utility Tools
    {
      name: 'validate_pmid',
      description: 'Validate PubMed ID format and check if article exists',
      inputSchema: {
        type: 'object',
        properties: {
          pmid: {
            type: 'string',
            description: 'PubMed ID to validate'
          }
        },
        required: ['pmid']
      }
    },
  • src/index.ts:482-483 (registration)
    Tool registration in the handler switch statement. Maps 'validate_pmid' case to handleValidatePMID function call.
    case 'validate_pmid':
      return await handleValidatePMID(args);
  • src/index.ts:395-396 (registration)
    Tool name registration in the tools array. Lists 'validate_pmid' as a tool with description.
    {
      name: 'validate_pmid',
  • Helper function isValidPMID that validates PMID format using regex /^\d+$/. Returns true if the string contains only digits.
    export function isValidPMID(pmid: string): boolean {
      return /^\d+$/.test(pmid);
    }
Behavior2/5

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

With no annotations, the description should fully explain behavior. It does not disclose what the tool returns (e.g., boolean, status message) or how it handles invalid PMIDs (error vs. false). This lack of detail hinders the agent's ability to interpret results.

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

Conciseness5/5

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

The description is a single, front-loaded sentence with no unnecessary words. It conveys the core purpose efficiently.

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?

Despite low complexity, the description omits critical details about output and error handling. For a validation tool, the agent needs to know what the return value looks like to make decisions. The description is incomplete for practical use.

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

Parameters4/5

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

The schema already describes the single parameter with 100% coverage. The tool description adds value by clarifying that the tool both validates format and checks existence, which goes beyond the parameter description alone.

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 tool's action (validate format and check existence) on a specific resource (PubMed ID). It distinguishes from siblings like get_article_details or batch_article_lookup, which retrieve data rather than validate.

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 is provided on when to use this tool versus alternatives such as get_article_details for detailed information. There is no mention of prerequisites or exclusions.

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