get_entity
Retrieve detailed information about a specific scholarly entity from OpenAlex's research catalog using its unique identifier.
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 primary handler function implementing the logic for the 'get_entity' tool. It constructs an API request to OpenAlex for the specified entity type and ID, using optional select and mailto parameters, and returns the JSON 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:207-221 (schema)The input schema defining the parameters for the 'get_entity' tool, including required entity_type and openalex_id, and optional fields.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:204-222 (registration)Registration of the 'get_entity' tool in the ListToolsRequestHandler, providing name, description, and input schema.{ 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)Tool dispatch logic in the CallToolRequestHandler switch statement, routing 'get_entity' calls to the getEntity handler function.case "get_entity": return await getEntity(args);
- src/index.ts:29-29 (registration)Import statement bringing in the getEntity handler from its module.import { getEntity } from "./tools/getEntity.js";