Skip to main content
Glama

get_full_text_links

Retrieve free full-text article links from PubMed Central and publisher sources using a PubMed ID to access biomedical research.

Instructions

Get links to free full text versions of an article (e.g., PubMed Central). Returns PMC links and publisher free-access URLs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pmidYesPubMed ID to find full text links for

Implementation Reference

  • The getFullTextLinks handler function that retrieves full text links for a PubMed article by calling NCBI's elink API. It fetches both PMC (PubMed Central) links and provider links, returning a JSON response with the PMID, full_text_links array, and a boolean indicating if free full text is available.
    export async function getFullTextLinks(args: z.infer<typeof getFullTextLinksSchema>): Promise<string> {
      // Use elink to find PMC links and provider links
      const result = await client.elinkCmd([args.pmid], "llinks", "pubmed") as {
        linksets?: Array<{
          idurllist?: Array<{
            objurls?: Array<{
              url?: { value?: string };
              linkname?: string;
              provider?: { name?: string[] };
              categories?: Array<{ category?: string }>;
            }>;
          }>;
        }>;
      };
    
      // Also check for PMC link
      const pmcResult = await client.elink([args.pmid], "pubmed_pmc", "pubmed", "pmc") as {
        linksets?: Array<{ linksetdbs?: Array<{ links?: string[] }> }>;
      };
    
      const pmcIds = pmcResult.linksets?.[0]?.linksetdbs?.[0]?.links || [];
      const links: Array<Record<string, string>> = [];
    
      if (pmcIds.length > 0) {
        links.push({
          source: "PubMed Central",
          url: `https://www.ncbi.nlm.nih.gov/pmc/articles/PMC${pmcIds[0]}/`,
          pmcid: `PMC${pmcIds[0]}`,
        });
      }
    
      // Extract provider links
      const urlList = result.linksets?.[0]?.idurllist?.[0]?.objurls || [];
      for (const obj of urlList) {
        const url = obj.url?.value;
        if (url) {
          links.push({
            source: obj.provider?.name?.[0] || obj.linkname || "Unknown",
            url,
          });
        }
      }
    
      return JSON.stringify({
        pmid: args.pmid,
        full_text_links: links,
        has_free_full_text: links.length > 0,
      }, null, 2);
    }
  • The Zod schema definition for getFullTextLinks that validates the input parameters. It requires a single parameter: pmid (PubMed ID as a string).
    export const getFullTextLinksSchema = z.object({
      pmid: z.string().describe("PubMed ID to find full text links for"),
    });
  • src/index.ts:70-77 (registration)
    Tool registration that registers get_full_text_links with the MCP server. It includes the tool name, description, schema shape, and the handler that calls getFullTextLinks with parsed arguments.
    server.tool(
      "get_full_text_links",
      "Get links to free full text versions of an article (e.g., PubMed Central). Returns PMC links and publisher free-access URLs.",
      getFullTextLinksSchema.shape,
      async (args) => ({
        content: [{ type: "text", text: await getFullTextLinks(getFullTextLinksSchema.parse(args)) }],
      })
    );

Tool Definition Quality

Score is being calculated. Check back soon.

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/PetrefiedThunder/mcp-pubmed'

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