# OpenAlex works counts by group

Count scholarly works matching a search or filter, grouped by one field: publication year, type, open access status, country or institution of authors, topic. Needs group by.

Count scholarly works matching a search or filter, grouped by one field: publication year, type, open access status, country or institution of authors, topic, field, source, funder, language or SDG. Returns each group's key, label and count (up to 200 groups). Use it for bibliometric trends, e.g. papers per year on a topic or top countries publishing on it.

- Tool ID: `openalex/works-group-by`
- Provider: [OpenAlex](/providers/openalex.md)
- Capability: [Scientific papers](/tools/knowledge/papers.md)
- Price: no charge per call
- Authentication: an authorised Agentik workspace is required for execution, including zero-price tools.

## Pricing contract

No charge per call. A workspace is still needed so your agent can call it.


```json
{
  "model": "per_call",
  "amountUsd": 0
}
```

## Complete input schema


```json
{
  "type": "object",
  "properties": {
    "search": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Full-text search over titles, abstracts and full texts, e.g. 'crispr'"
    },
    "filter": {
      "type": "string",
      "maxLength": 300,
      "pattern": "^[^&#]*$",
      "description": "OpenAlex works filter, e.g. 'publication_year:2020-2025,is_oa:true'"
    },
    "group_by": {
      "type": "string",
      "enum": [
        "publication_year",
        "type",
        "open_access.oa_status",
        "authorships.countries",
        "authorships.institutions.lineage",
        "primary_topic.id",
        "primary_topic.field.id",
        "primary_location.source.id",
        "funders.id",
        "language",
        "sustainable_development_goals.id",
        "is_retracted"
      ],
      "description": "Field to group by, e.g. 'publication_year'"
    }
  },
  "required": [
    "group_by"
  ],
  "additionalProperties": false,
  "anyOf": [
    {
      "required": [
        "search"
      ]
    },
    {
      "required": [
        "filter"
      ]
    }
  ]
}
```

## Published example

This is the provider tool’s published example. Replace example values with the user’s requested inputs, respecting the schema; do not execute an example merely to test a connection.


```json
{
  "tool_id": "openalex/works-group-by",
  "input": {
    "search": "crispr",
    "filter": "publication_year:2020-2025",
    "group_by": "publication_year"
  }
}
```

## Execute and retrieve

Inspect again before execution, explain the price and obtain the required authority. Use MCP run_tool or POST /v1/run with this tool ID, valid input and an idempotency key. Save the returned run ID and follow the actual state. If Agentik answers that the tool is temporarily unavailable, do not retry it blindly; use discovery to propose an alternative.

A partial or uncertain result can still have consumed provider resources. Consult [billing](/docs/billing.md), [idempotency](/docs/idempotency.md) and [asynchronous results](/docs/async.md).

Licence: CC0 1.0.

Attribution: Data from OpenAlex (CC0).

[Provider documentation](https://help.openalex.org/api/grouping/)

[REST inspection](https://api.agentik.cc/v1/tools/openalex/works-group-by) · [OpenAPI](/openapi.json) · [Connection guide](/connect.md)

---

[HTML page](/providers/openalex/works-group-by) · [Agent index](/llms.txt)
