Skip to main content
Glama
reetp14

OpenAlex MCP Server

by reetp14

get_entity

Retrieve detailed information about a specific scholarly entity from OpenAlex using its unique ID, supporting works, authors, institutions, sources, topics, publishers, and funders.

Instructions

Get a single entity by its OpenAlex ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_typeYesType of entity to retrieve
openalex_idYesOpenAlex ID (e.g., W2741809807, A1969205038)
selectNoComma-separated list of fields to return
mailtoNoEmail for rate limits
api_keyNoPremium API key

Implementation Reference

  • The main handler function for the 'get_entity' tool. It extracts parameters from args, constructs query params, calls makeOpenAlexRequest to fetch the entity data from OpenAlex API, and returns the JSON stringified response as text content.
    export async function getEntity(args: any) {
        const { entity_type, openalex_id, select, mailto } = args;
        const params: Record<string, any> = {};
        if (select)
            params.select = select;
        if (mailto)
            params.mailto = mailto;
        return {
            content: [{
                    type: "text",
                    text: JSON.stringify(await makeOpenAlexRequest(`/${entity_type}/${openalex_id}`, params), null, 2)
                }]
        };
    }
  • The input schema definition for the 'get_entity' tool provided in the ListTools response, specifying required and optional parameters with types and descriptions.
    {
        name: "get_entity",
        description: "Get a single entity by its OpenAlex ID",
        inputSchema: {
            type: "object",
            properties: {
                entity_type: {
                    type: "string",
                    enum: ["works", "authors", "sources", "institutions", "topics", "publishers", "funders"],
                    description: "Type of entity to retrieve"
                },
                openalex_id: { type: "string", description: "OpenAlex ID (e.g., W2741809807, A1969205038)" },
                select: { type: "string", description: "Comma-separated list of fields to return" },
                mailto: { type: "string", description: "Email for rate limits" },
                api_key: { type: "string", description: "Premium API key" }
            },
            required: ["entity_type", "openalex_id"]
        }
    },
  • src/index.ts:295-296 (registration)
    The switch case in the CallToolRequest handler that registers and dispatches calls to the 'get_entity' tool by invoking the getEntity function.
    case "get_entity":
        return await getEntity(args);
  • src/index.ts:29-29 (registration)
    Import statement that brings the getEntity handler into the main index file for use in tool dispatching.
    import { getEntity } from "./tools/getEntity.js";

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/reetp14/openalex-mcp'

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