Skip to main content
Glama
reetp14
by reetp14

autocomplete

Search OpenAlex's scholarly database to get instant suggestions for works, authors, institutions, journals, concepts, publishers, and funders as you type.

Instructions

Type ahead search across any OpenAlex entity type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchYesSearch query for autocomplete
typeNoEntity type to search within
per_pageNoNumber of suggestions (max 50)
mailtoNoEmail for rate limits
api_keyNoPremium API key

Implementation Reference

  • The primary handler function implementing the 'autocomplete' tool logic. It calls the shared makeOpenAlexRequest utility with the '/autocomplete' endpoint and args, then wraps the JSON response in the MCP content format.
    export async function autocomplete(args: any) { return { content: [{ type: "text", text: JSON.stringify(await makeOpenAlexRequest("/autocomplete", args), null, 2) }] }; }
  • src/index.ts:224-241 (registration)
    Registration of the 'autocomplete' tool in the ListTools response, including 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 mapping the 'autocomplete' tool name to its handler function in the CallTool request handler switch statement.
    case "autocomplete": return await autocomplete(args);
  • 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; }
  • Shared utility function used by the autocomplete handler (and others) to make HTTP requests to OpenAlex API endpoints.
    export async function makeOpenAlexRequest(endpoint: string, params: OpenAlexQueryParams = {}): Promise<any> {

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