autocomplete
Find scholarly entities in OpenAlex by typing search terms, with suggestions for works, authors, institutions, and other research data types.
Instructions
Type ahead search across any OpenAlex entity type
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | Yes | Search query for autocomplete | |
| type | No | Entity type to search within | |
| per_page | No | Number of suggestions (max 50) | |
| mailto | No | Email for rate limits | |
| api_key | No | Premium API key |
Implementation Reference
- src/tools/autocomplete.ts:3-10 (handler)The core handler function for the 'autocomplete' tool. It calls the OpenAlex /autocomplete endpoint using makeOpenAlexRequest utility and returns the JSON response formatted as MCP text content.export async function autocomplete(args: any) { return { content: [{ type: "text", text: JSON.stringify(await makeOpenAlexRequest("/autocomplete", args), null, 2) }] }; }
- src/index.ts:226-240 (schema)Input schema for the autocomplete tool, defining the expected arguments including the required 'search' query and optional parameters.inputSchema: { type: "object", properties: { search: { type: "string", description: "Search query for autocomplete", required: true }, type: { type: "string", enum: ["works", "authors", "sources", "institutions", "concepts", "publishers", "funders"], description: "Entity type to search within" }, per_page: { type: "number", description: "Number of suggestions (max 50)" }, mailto: { type: "string", description: "Email for rate limits" }, api_key: { type: "string", description: "Premium API key" } }, required: ["search"] }
- src/index.ts:223-241 (registration)Registration of the 'autocomplete' tool in the MCP listTools handler, providing name, description, and input schema.{ name: "autocomplete", description: "Type ahead search across any OpenAlex entity type", inputSchema: { type: "object", properties: { search: { type: "string", description: "Search query for autocomplete", required: true }, type: { type: "string", enum: ["works", "authors", "sources", "institutions", "concepts", "publishers", "funders"], description: "Entity type to search within" }, per_page: { type: "number", description: "Number of suggestions (max 50)" }, mailto: { type: "string", description: "Email for rate limits" }, api_key: { type: "string", description: "Premium API key" } }, required: ["search"] } },
- src/index.ts:297-298 (registration)Dispatch/registration in the main CallToolRequest switch statement that routes to the autocomplete handler.case "autocomplete": return await autocomplete(args);
- src/types.ts:468-476 (schema)TypeScript interface defining the structure of autocomplete results from OpenAlex API.export interface AutocompleteResult { id: string; display_name: string; hint?: string; cited_by_count?: number; works_count?: number; entity_type: string; external_id?: string; }