Skip to main content
Glama
malkreide

swiss-statistics-mcp

by malkreide

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MCP_HOSTNoHost to bind the HTTP server to. Default is 127.0.0.1. Set to 0.0.0.0 for cloud deployment.
MCP_LOG_LEVELNoLog level (e.g., DEBUG, INFO, WARNING). Default is INFO.
MCP_RETRY_WAIT_MAXNoMaximum wait time in seconds for exponential backoff. Default is 4.
MCP_RETRY_MAX_ATTEMPTSNoMaximum number of retry attempts for transient BFS API errors. Default is 3.
MCP_RETRY_WAIT_INITIALNoInitial wait time in seconds for exponential backoff. Default is 0.5.

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
bfs_list_themesA

List all 21 BFS statistical themes with their codes and dataset counts.

Returns the complete taxonomy of Swiss federal statistics. Each theme has a 2-digit code used to filter datasets with bfs_list_tables_by_theme.

Args: params (ListThemesInput): - lang (str): Language code ('de', 'fr', 'it', 'en')

Returns: ListThemesResult with theme codes, names, dataset counts per theme. On error, error and hint are set and themes is None.

bfs_list_tables_by_themeA

List available statistical tables for a specific BFS theme.

Returns table IDs and titles for a given theme code. Use the returned table_id values with bfs_get_table_metadata and bfs_get_data.

Args: params (ListTablesByThemeInput): - theme_code (str): 2-digit theme code, e.g. '15' for Bildung - lang (str): Language code - limit (int): Max tables to return (default 20)

Returns: ListTablesByThemeResult with the matching tables list. On error, error and hint are set and tables is None.

bfs_search_tablesA

Search for BFS statistical tables by keyword in their titles.

Performs a full-text search across all 682+ BFS table titles. Results include table IDs needed for bfs_get_table_metadata and bfs_get_data.

Note: First call builds a catalog (~682 API requests). Subsequent calls within 1 hour use the cached catalog and are instant.

Args: params (SearchTablesInput): - query (str): Search keywords, e.g. 'Lehrkräfte', 'Schüler Kanton' - theme_code (Optional[str]): Filter by theme, e.g. '15' - lang (str): Language for table titles - limit (int): Max results (default 10)

Returns: SearchTablesResult with matching tables. On error, error and hint are set and results is None.

bfs_get_table_metadataA

Get metadata for a BFS table: title, variables, and available filter values.

Essential step before calling bfs_get_data. Returns all dimension variables with their codes and value labels needed to construct data queries.

Args: params (GetTableMetadataInput): - table_id (str): BFS table ID, e.g. 'px-x-1504000000_173' - lang (str): Language for labels

Returns: str: JSON with table title, source, update date, and all variables with their codes and value options. Use variable codes in bfs_get_data filters.

Example output structure: { "title": "Lehrkräfte nach Schuljahr, Kanton...", "variables": [ { "code": "Schuljahr", "label": "Schuljahr", "n_values": 14, "values": [{"code": "0", "label": "2010/11"}, ...] } ] }

bfs_get_dataA

Query statistical data from a BFS table with optional filters.

Fetches actual data values from a STAT-TAB table. Always call bfs_get_table_metadata first to understand available variables and values.

Args: params (GetDataInput): - table_id (str): BFS table ID - filters (Optional[list]): Dimension filters to narrow results. Each filter: {"code": "VariableCode", "values": ["val1", "val2"]} Without filters, all data is returned (may be very large). - lang (str): Language for labels - max_rows (int): Safety limit on returned rows (default 500)

Returns: DataTableResult with dimensions, rows, plus truncated, rows_total, rows_returned for machine-readable capping. On error, error and hint are set.

bfs_education_statsA

Retrieve Swiss education statistics — convenience tool for Schulamt context.

Provides direct access to key education datasets without needing to know table IDs or variable codes. Covers teachers, students, enrollment scenarios, and scholarship data, optionally filtered by canton.

Args: params (GetEducationStatsInput): - topic (str): One of: 'teachers', 'students', 'scenarios', 'scholarships' - canton (Optional[str]): Canton name, e.g. 'Zürich'. None = all cantons. - lang (str): Language code

Returns: DataTableResult with topic, topic_description, canton_filter on success, plus the data table fields. On error, error and hint are set.

bfs_populationA

Retrieve Swiss population statistics by region, year, and breakdown.

Accesses the core BFS population dataset (ständige Wohnbevölkerung) with flexible filtering by canton/municipality, year, age, and gender. Critical for school space planning and demographic projections.

Args: params (GetPopulationInput): - region (str): 'Schweiz', or canton name like 'Zürich' - year (Optional[str]): Year filter, e.g. '2024' - breakdown (str): 'total', 'age', or 'gender'

Returns: str: JSON with population figures for the selected region and breakdown.

bfs_compare_cantonsA

Compare a BFS statistical indicator across multiple Swiss cantons.

Designed for KI-Fachgruppe demos and benchmarking. Fetches the same dataset for multiple cantons simultaneously, enabling direct comparison.

Args: params (CompareCantonsInput): - table_id (str): BFS table ID to query - canton_values (list[str]): Canton value codes to compare. Use '0' for Switzerland total, '1' for Zürich, '2' for Bern, etc. Get codes via bfs_get_table_metadata on any canton-level table. - additional_filters (Optional[list]): Extra dimension filters - lang (str): Language code

Returns: str: JSON with data for all selected cantons side by side.

Example use case: Compare teacher-to-student ratios across ZH, BE, LU, CH total: canton_values=['0', '1', '2', '3']

bfs_featured_datasetsA

Return a curated list of high-value BFS datasets for Schulamt and public administration.

Provides a shortlist of the most relevant datasets for education planning, demographic analysis, and political context — ideal as a starting point.

Args: params (ListThemesInput): - lang (str): Language code

Returns: FeaturedDatasetsResult with curated table IDs, titles, themes, and recommended use cases.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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/malkreide/swiss-statistics-mcp'

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