Skip to main content
Glama

top_n

Retrieve the top or bottom N records across a chosen workplace gender equality measure, with optional filters and reporting year. Server-side ranking avoids fetching full datasets.

Instructions

Return the N rows with the largest (or smallest) value of a measure.

Ranks across one WGEA reporting year (the latest by default, or a specific year via reporting_year=). This is the most common agent workflow — "show me the top 10 X by Y" — collapsed into a single server-side call: rank-and-slice happens on the server so the agent never has to fetch a full table just to take the top of it.

Examples: # 10 employers with the most women managers (latest reporting year) top_n("WORKFORCE_COMPOSITION", "n_employees", n=10, filters={"gender": "Women", "manager_category": "Manager"})

# 5 ANZSIC divisions with the fewest Yes responses on Gender Pay Gap
top_n("GENDER_EQUALITY_ACTIONS", "n_responses", n=5, direction="bottom",
      filters={"section": "Gender Pay Gap", "response": "Yes"})

# Top 5 employers in Mining by total workforce in 2023-24
top_n("WORKFORCE_COMPOSITION", "n_employees", n=5,
      filters={"anzsic_division": "Mining"},
      reporting_year="2023-24")

Returns: DataResponse with at most n records, sorted by measure value in the requested direction. Other fields (reporting_year, unit, attribution) match a regular get_data call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nNoHow many top (or bottom) rows to return.
filtersNoOptional dimension filters, same shape as get_data.
measureYesNumeric measure column to rank by. WGEA measures are `n_employees` (WORKFORCE_COMPOSITION, WORKFORCE_MANAGEMENT) or `n_responses` (the other five questionnaire datasets). Use the describe endpoint or describe tool to confirm.
directionNo'top' returns the N rows with the LARGEST measure values (highest n_employees, biggest n_responses, etc.). 'bottom' returns the SMALLEST.top
dataset_idYesCurated dataset ID. Use the search or list-curated endpoint/tool to discover.
reporting_yearNoOptional single WGEA reporting year to restrict the ranking to. Format: 'YYYY-YY' (e.g. '2024-25') or 'YYYY' (e.g. '2024'). Defaults to the latest reporting year present in the data so the rank is a clean 'top N at the current reporting year' view.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
csvNo
unitNo
queryNo
staleNo
periodNoCanonical period bounds {start, end} for cross-sister consumers. Populated alongside the wgea-specific reporting_year. For a single reporting year both bounds match; for multi-year spans they bracket the range.
sourceNoWorkplace Gender Equality Agency
recordsNo
row_countNo
dataset_idYes
source_urlYes
attributionNoSource: Workplace Gender Equality Agency. Licensed under Creative Commons Attribution 3.0 Australia (https://creativecommons.org/licenses/by/3.0/au/). Original dataset: https://data.gov.au/data/dataset/wgea-dataset
dataset_nameYes
did_you_meanNo
download_urlNo
retrieved_atYes
stale_reasonNo
truncated_atNo
reporting_yearNo
server_versionNo
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses ranking across one reporting year, default behavior, sorting, and return format. No contradictions. Could mention read-only nature but implied.

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

Conciseness4/5

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

Well-structured with purpose, context, examples, and return info. Examples are helpful but make it slightly longer. Still clear and front-loaded.

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

Completeness4/5

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

Given 6 parameters and output schema exists, description covers concept, parameters, examples, and return. Could mention error handling but complete enough for typical use.

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

Parameters4/5

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

Input schema covers 100% of parameters with descriptions. Description adds value by explaining measure meaning per dataset, reporting year format, and providing examples that illustrate usage.

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

Purpose5/5

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

The description clearly states the tool returns the N rows with largest/smallest measure value. It distinguishes from sibling tools like get_data by explaining server-side rank-and-slice, and provides concrete examples.

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

Usage Guidelines4/5

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

The description indicates this is the most common agent workflow for top N queries and contrasts with fetching full tables. It defaults to latest year but doesn't explicitly state when not to use it, though the context is clear.

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/Bigred97/wgea-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server