Skip to main content
Glama
reetp14

OpenAlex MCP Server

by reetp14

get_filterable_fields

Retrieve filterable field names and types for OpenAlex entities to enable precise scholarly data queries and filtering.

Instructions

Get a list of filterable field names and their types for a specified OpenAlex entity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_typeYesThe type of OpenAlex entity for which to retrieve filterable fields.

Implementation Reference

  • The primary handler function for the 'get_filterable_fields' tool. It extracts 'entity_type' from args, populates a list of filterable fields based on a switch statement for different OpenAlex entities, and returns them as formatted JSON in MCP content format.
    export async function getFilterableFields(args: any) {
        const { entity_type } = args as { entity_type: EntityType | string };
        let fields: any[] = [];
        switch (entity_type) {
            case "works":
                fields = [
                    // Attribute Filters from Work object
                    { name: "authorships.author.id", type: "string", category: "attribute", description: "OpenAlex ID of an author." },
                    { name: "authorships.author.orcid", type: "string", category: "attribute", description: "ORCID of an author." },
                    { name: "authorships.countries", type: "string", category: "attribute", description: "Country codes associated with author affiliations." },
                    { name: "authorships.institutions.id", type: "string", category: "attribute", description: "OpenAlex ID of an author's institution." },
                    { name: "apc_paid.value_usd", type: "number", category: "attribute", description: "APC paid value in USD." },
                    { name: "best_oa_location.license", type: "string", category: "attribute", description: "License of the best OA location." },
                    { name: "biblio.volume", type: "string", category: "attribute", description: "Volume number." },
                    { name: "cited_by_count", type: "integer", category: "attribute", description: "Total number of times this work has been cited." },
                    { name: "concepts.id", type: "string", category: "attribute", description: "OpenAlex ID of an associated concept/topic." },
                    { name: "doi", type: "string", category: "attribute", description: "Digital Object Identifier of the work." },
                    { name: "has_fulltext", type: "boolean", category: "attribute", description: "Indicates if full text is available via OpenAlex." },
                    { name: "ids.openalex", type: "string", category: "attribute", description: "OpenAlex ID of the work." },
                    { name: "ids.pmid", type: "string", category: "attribute", description: "PubMed ID of the work." },
                    { name: "is_paratext", type: "boolean", category: "attribute", description: "Indicates if the work is paratext (e.g., cover, table of contents)." },
                    { name: "is_retracted", type: "boolean", category: "attribute", description: "Indicates if the work has been retracted." },
                    { name: "language", type: "string", category: "attribute", description: "Language code of the work." },
                    { name: "locations.is_oa", type: "boolean", category: "attribute", description: "Indicates if a specific location is Open Access." },
                    { name: "open_access.is_oa", type: "boolean", category: "attribute", description: "Overall Open Access status of the work." },
                    { name: "open_access.oa_status", type: "string", category: "attribute", description: "OA status (e.g., gold, green, hybrid)." },
                    { name: "primary_location.source.id", type: "string", category: "attribute", description: "OpenAlex ID of the primary hosting source." },
                    { name: "publication_year", type: "integer", category: "attribute", description: "Year of publication." },
                    { name: "publication_date", type: "date", category: "attribute", description: "Full publication date (YYYY-MM-DD)." },
                    { name: "type", type: "string", category: "attribute", description: "Type of the work (e.g., article, book)." },
                    // Convenience Filters for Works
                    { name: "abstract.search", type: "string", category: "convenience", description: "Full-text search within the work's abstract." },
                    { name: "authors_count", type: "integer", category: "convenience", description: "Number of authors for the work." },
                    { name: "cited_by", type: "string", category: "convenience", description: "OpenAlex ID of a work that this work cites (outgoing citations)." },
                    { name: "cites", type: "string", category: "convenience", description: "OpenAlex ID of a work that cites this work (incoming citations)." },
                    { name: "display_name.search", type: "string", category: "convenience", description: "Full-text search within the work's title (alias: title.search)." },
                    { name: "from_publication_date", type: "date", category: "convenience", description: "Filter for works published on or after this date." },
                    { name: "to_publication_date", type: "date", category: "convenience", description: "Filter for works published on or before this date." },
                    { name: "has_abstract", type: "boolean", category: "convenience", description: "Indicates if the work has an abstract." },
                    { name: "has_doi", type: "boolean", category: "convenience", description: "Indicates if the work has a DOI." },
                ];
                break;
            case "authors":
                fields = [ { name: "orcid", type: "string", category: "attribute", description: "Author's ORCID iD." }, { name: "display_name.search", type: "string", category: "convenience", description: "Search by author's display name."} /* ... more author filters ... */ ];
                break;
            case "sources":
                fields = [ { name: "issn", type: "string", category: "attribute", description: "Source's ISSN." }, { name: "is_oa", type: "boolean", category: "attribute", description: "If the source is fully OA."} /* ... more source filters ... */ ];
                break;
            case "institutions":
                fields = [ { name: "ror", type: "string", category: "attribute", description: "Institution's ROR ID." }, { name: "country_code", type: "string", category: "attribute", description: "Institution's country code."} /* ... more institution filters ... */ ];
                break;
            case "topics":
                fields = [ { name: "domain.id", type: "string", category: "attribute", description: "ID of the topic's domain." }, { name: "display_name.search", type: "string", category: "convenience", description: "Search by topic's display name."} /* ... more topic filters ... */ ];
                break;
            case "publishers":
                fields = [ { name: "country_codes", type: "string", category: "attribute", description: "Publisher's country codes." }, { name: "display_name.search", type: "string", category: "convenience", description: "Search by publisher's display name."} /* ... more publisher filters ... */ ];
                break;
            case "funders":
                fields = [ { name: "country_code", type: "string", category: "attribute", description: "Funder's country code." }, { name: "display_name.search", type: "string", category: "convenience", description: "Search by funder's display name."} /* ... more funder filters ... */ ];
                break;
            default:
                throw new Error(`Unknown entity_type for get_filterable_fields: ${entity_type}`);
        }
        return {
            content: [{
                type: "text",
                text: JSON.stringify(fields, null, 2)
            }]
        };
    }
  • The input schema definition for the 'get_filterable_fields' tool, registered in the ListTools response, specifying the expected 'entity_type' parameter.
        name: "get_filterable_fields",
        description: "Get a list of filterable field names and their types for a specified OpenAlex entity.",
        inputSchema: {
            type: "object",
            properties: {
                entity_type: {
                    type: "string",
                    enum: ["works", "authors", "sources", "institutions", "topics", "publishers", "funders"],
                    description: "The type of OpenAlex entity for which to retrieve filterable fields."
                }
            },
            required: ["entity_type"]
        }
    }
  • src/index.ts:301-302 (registration)
    The dispatch case in the CallToolRequest handler that routes calls to 'get_filterable_fields' to the getFilterableFields handler function.
    case "get_filterable_fields":
        return await getFilterableFields(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on traits like whether it's read-only, its response format (e.g., list structure), potential rate limits, or error handling. For a tool with no annotations, this is a significant gap in transparency.

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 is front-loaded and appropriately sized for its complexity, with zero waste, making it easy to parse quickly.

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 tool's complexity (metadata retrieval with no output schema) and lack of annotations, the description is incomplete. It does not explain the return values (e.g., format of the list, what 'types' entail) or behavioral aspects like idempotency. For a tool with no structured output information, more detail 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, with the parameter 'entity_type' fully documented in the schema (including enum values). The description adds no additional meaning beyond what the schema provides, such as explaining why filterable fields vary by entity type or how the output relates to the parameter. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('Get a list') and the resource ('filterable field names and their types for a specified OpenAlex entity'), making the purpose evident. However, it does not explicitly differentiate this tool from its siblings (e.g., search_* tools or get_entity), which focus on retrieving entities rather than metadata about filterable fields.

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. It does not mention prerequisites, such as needing to know the entity type beforehand, or compare it to sibling tools like autocomplete or classify_text, which might serve related but different purposes in filtering or searching contexts.

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