Skip to main content
Glama
reetp14

OpenAlex MCP Server

by reetp14

search_works

Search scholarly works in the OpenAlex database using queries, filters, sorting, and pagination to find research papers and academic publications.

Instructions

Search scholarly works in OpenAlex

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchNoFull-text search query
filterNoKey:value OpenAlex filters. Supports entity attributes (e.g., 'publication_year', 'is_oa'), IDs, and convenience filters (e.g., 'title.search'). Example: 'is_oa:true,type:journal'
sortNoSort field with optional :desc (e.g., 'cited_by_count:desc')
pageNoPage number (max 10,000 results total)
per_pageNoResults per page (max 200)
cursorNoCursor for deep pagination (use '*' for first call)
group_byNoGroup results by field for faceting
selectNoComma-separated list of fields to return
sampleNoRandom sample size
seedNoRandom seed for reproducible sampling
mailtoNoEmail for rate limits
api_keyNoPremium API key
bearer_tokenNoBearer token for authentication
viewNoThe view of the data to return. 'summary' returns a concise version, 'full' returns the complete object.

Implementation Reference

  • The handler function that executes the search_works tool logic. It calls the OpenAlex API for /works endpoint, optionally summarizes results (limits authorships and concepts) based on 'view:summary' parameter, and returns formatted JSON response.
    export async function searchWorks(args: any) {
        const { view, ...searchArgs } = args;
        if (view === 'summary') {
            // Define the fields for the summary view
            searchArgs.select = 'id,doi,title,publication_year,type,cited_by_count,authorships,concepts,primary_location,open_access,best_oa_location';
            
            const data = await makeOpenAlexRequest("/works", searchArgs);
    
            // Process the results to create the summary
            const summarizedResults = data.results.map((work: Work) => {
                // Limit authorships
                if (work.authorships && work.authorships.length > 5) {
                    work.authorships = work.authorships.slice(0, 5);
                }
                // Limit concepts
                if (work.concepts && work.concepts.length > 3) {
                    // Assuming concepts are sorted by score, which is typical.
                    // If not, we might need to sort them first.
                    work.concepts = work.concepts.slice(0, 3);
                }
                return work;
            });
    
            return {
                content: [{
                    type: "text",
                    text: JSON.stringify({ ...data, results: summarizedResults }, null, 2)
                }]
            };
        } else {
            return {
                content: [{
                        type: "text",
                        text: JSON.stringify(await makeOpenAlexRequest("/works", args), null, 2)
                    }]
            };
        }
    }
  • Input schema definition for the search_works tool, specifying parameters like search, filter, sort, pagination, and view options.
    inputSchema: {
        type: "object",
        properties: {
            search: { type: "string", description: "Full-text search query" },
            filter: { type: "string", description: "Key:value OpenAlex filters. Supports entity attributes (e.g., 'publication_year', 'is_oa'), IDs, and convenience filters (e.g., 'title.search'). Example: 'is_oa:true,type:journal'" },
            sort: { type: "string", description: "Sort field with optional :desc (e.g., 'cited_by_count:desc')" },
            page: { type: "number", description: "Page number (max 10,000 results total)" },
            per_page: { type: "number", description: "Results per page (max 200)" },
            cursor: { type: "string", description: "Cursor for deep pagination (use '*' for first call)" },
            group_by: { type: "string", description: "Group results by field for faceting" },
            select: { type: "string", description: "Comma-separated list of fields to return" },
            sample: { type: "number", description: "Random sample size" },
            seed: { type: "number", description: "Random seed for reproducible sampling" },
            mailto: { type: "string", description: "Email for rate limits" },
            api_key: { type: "string", description: "Premium API key" },
            bearer_token: { type: "string", description: "Bearer token for authentication" },
            view: { type: "string", "enum": ["summary", "full"], description: "The view of the data to return. 'summary' returns a concise version, 'full' returns the complete object." }
        }
    }
  • src/index.ts:55-77 (registration)
    Registration of the search_works tool in the ListTools response, including name, description, and schema.
    {
        name: "search_works",
        description: "Search scholarly works in OpenAlex",
        inputSchema: {
            type: "object",
            properties: {
                search: { type: "string", description: "Full-text search query" },
                filter: { type: "string", description: "Key:value OpenAlex filters. Supports entity attributes (e.g., 'publication_year', 'is_oa'), IDs, and convenience filters (e.g., 'title.search'). Example: 'is_oa:true,type:journal'" },
                sort: { type: "string", description: "Sort field with optional :desc (e.g., 'cited_by_count:desc')" },
                page: { type: "number", description: "Page number (max 10,000 results total)" },
                per_page: { type: "number", description: "Results per page (max 200)" },
                cursor: { type: "string", description: "Cursor for deep pagination (use '*' for first call)" },
                group_by: { type: "string", description: "Group results by field for faceting" },
                select: { type: "string", description: "Comma-separated list of fields to return" },
                sample: { type: "number", description: "Random sample size" },
                seed: { type: "number", description: "Random seed for reproducible sampling" },
                mailto: { type: "string", description: "Email for rate limits" },
                api_key: { type: "string", description: "Premium API key" },
                bearer_token: { type: "string", description: "Bearer token for authentication" },
                view: { type: "string", "enum": ["summary", "full"], description: "The view of the data to return. 'summary' returns a concise version, 'full' returns the complete object." }
            }
        }
    },
  • src/index.ts:281-282 (registration)
    Dispatch/registration in the CallToolRequest handler switch statement that invokes the searchWorks handler.
    case "search_works":
        return await searchWorks(args);
  • Import statement that resolves to the searchWorks handler implementation.
    import { searchWorks } from "./tools/searchWorks.js";
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action without mentioning rate limits (implied by the 'mailto' parameter), authentication needs (implied by 'api_key' and 'bearer_token'), pagination behavior, or error handling. It fails to provide crucial operational context beyond the minimal purpose statement.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly while avoiding redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (14 parameters, no annotations, no output schema), the description is inadequate. It doesn't explain return values, error conditions, or behavioral traits like rate limiting or authentication requirements. For a search tool with many parameters and no structured safety hints, more descriptive context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, thoroughly documenting all 14 parameters with examples and constraints. The description adds no parameter-specific information beyond what's already in the schema, so it meets the baseline of 3 for high schema coverage without compensating with additional semantic context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Search') and resource ('scholarly works in OpenAlex'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling search tools (search_authors, search_funders, etc.) beyond specifying 'works' as the target, which is good but not explicit about how it differs from other search tools in the same domain.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_entity' or other search tools for different entity types. It lacks explicit context about use cases, exclusions, or comparisons with sibling tools, leaving the agent to infer usage based on the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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