Skip to main content
Glama
reetp14
by reetp14

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
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 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) }] }; }
  • 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);
  • 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; }

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