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
| Name | Required | Description | Default |
|---|---|---|---|
| entity_type | Yes | Type of entity to retrieve | |
| openalex_id | Yes | OpenAlex ID (e.g., W2741809807, A1969205038) | |
| select | No | Comma-separated list of fields to return | |
| mailto | No | Email for rate limits | |
| api_key | No | Premium API key |
Implementation Reference
- src/tools/getEntity.ts:3-16 (handler)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) }] }; }
- src/index.ts:204-222 (schema)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";