# Aragón Open Data MCP

> Aragón Open Data connects your AI agent directly to the Government of Aragón's public record portal. You can query massive regional datasets, check API schemas, and search official government metadata using natural language prompts.

## Overview
- **Category:** knowledge-management
- **Price:** Free
- **Tags:** open-data, aragon, ckan, public-records, data-exploration

## Description

You need deep insights from local government data but don't have time for manual CSV downloads or complex database joins. This MCP lets your agent browse the entire Aragón Open Data catalog—regional statistics, environmental readings, population counts—and pull records directly into your workflow. You tell it what you want to know; it handles the search and filtering across dozens of official views.

It’s like having a dedicated data librarian who knows where every single public record lives. Need to understand if a dataset is current? Run a schema check first. Want to find out which organizations publish specific types of records? The agent finds those publisher details automatically. For the most advanced queries, you can run SPARQL against known ontologies like Aragopedia. Accessing this level of regional data usually requires specialized API calls, but here, all that complexity is handled by connecting through Vinkius.



## Tools

### count_datasets
Counts and reports the total number of available datasets in the catalog.

### get_organization
Gets detailed information about a particular data publisher or organization.

### get_dataset
Retrieves full details about a specific dataset package.

### get_tag
Retrieves details for a specified metadata tag.

### list_groups
Lists every defined theme or group used to categorize datasets.

### list_organizations
Retrieves a list of all organizations that publish data in the region.

### list_datasets
Lists all available dataset packages in the public catalog.

### list_tags
Lists every defined metadata tag available for filtering datasets.

### list_views
Retrieves a list of all distinct data views currently available in the catalog.

### most_downloaded_datasets
Identifies and lists the datasets that have been downloaded most frequently.

### newest_datasets
Fetches a list of recently added or updated datasets.

### preview_data
Samples and shows the first few records from a selected data view or resource.

### query_sparql
Executes advanced SPARQL queries against specific regional ontologies.

### search_datasets
Finds datasets by running a targeted search query across the entire catalog.

### show_columns
Displays column names and data types for a given dataset view.

## Prompt Examples

**Prompt:** 
```
List all available data views in Aragón Open Data.
```

**Response:** 
```
I've retrieved the list of available views. There are several registered views including 'Censo de Viviendas', 'Presupuestos Municipales', and 'Calidad del Aire'. Which one would you like to explore?
```

**Prompt:** 
```
Search for datasets related to 'turismo' in the catalog.
```

**Response:** 
```
Searching the CKAN catalog... I found several datasets related to tourism, such as 'Ocupación Turística' and 'Red de Oficinas de Turismo'. Would you like the details for a specific one?
```

**Prompt:** 
```
Show me the first 5 records from the view with ID '702'.
```

**Response:** 
```
Fetching data preview for view 702... Here are the first 5 records containing fields like 'Municipio', 'Año', and 'Valor'. The data shows a breakdown of local demographics for the selected period.
```

## Capabilities

### Browse available datasets and views
List every dataset package or data view registered in the public catalog so you know what records exist.

### Preview specific record sets
Fetch a sample of actual data records from a chosen view, supporting filters and pagination to narrow down results.

### Inspect the data structure
Retrieve column names and data types for any given dataset view, confirming if the data is structured how you expect it.

### Search across metadata
Find specific datasets, tags, or publishing organizations using Solr-powered keyword searches.

### Execute complex graph queries
Run formal SPARQL queries against established knowledge graphs like Aragopedia for highly structured data relationships.

## Use Cases

### Linking health data to housing trends
A researcher needs to correlate local air quality readings with census demographics. They ask the agent to find relevant views for both topics and then use 'query_sparql' to join them, avoiding weeks of manual data alignment.

### Building a dashboard on current legislation
A developer needs to know which organizations publish records related to zoning laws. They ask the agent to run 'list_organizations', then filter by theme using 'list_groups' to get a clear list of data sources.

### Auditing public transparency reports
A journalist needs to check if all required annual expenditure reports are available. They use 'search_datasets' and then run 'get_dataset' on the top results to verify publication dates and scope.

### Verifying data pipeline inputs
An internal analyst has a new dashboard that relies on public records. They first use 'list_views' and 'show_columns' to validate the underlying schema before writing any integration code.

## Benefits

- Stop manual data collection. Instead of downloading dozens of CSV files, your agent can execute 'list_views' and then use 'preview_data' to see exactly what records you need, instantly.
- Pinpoint specific sources fast. If you know the topic but not the dataset name, run 'search_datasets' or filter by tags using 'list_tags' until you zero in on the right package.
- Handle complex data structures without writing SQL. Use 'query_sparql' to ask questions about relationships (e.g., linking demographics to economic zones) that basic views can't show.
- Save time debugging APIs. Before coding, run 'show_columns' on a view. You immediately confirm the field names and data types you need for your application logic.
- Keep track of what matters. Run 'most_downloaded_datasets' to see which government records are most frequently used by others, helping you prioritize your research.

## How It Works

The bottom line is, you talk to it naturally, and it translates that into precise data calls against government records.

1. Subscribe to this MCP and enter your API key (if required by the specific endpoint).
2. Tell your AI client what you need—for example, 'Show me all available views related to housing.'
3. The agent executes the correct underlying search or query using the appropriate tool and returns structured data.

## Frequently Asked Questions

**How do I check what data is available using list_views?**
Running 'list_views' provides a comprehensive directory of every specific, prepared dataset view. This tells you the exact ID and name of the record set you need to query or preview.

**Can I run complex queries with query_sparql?**
Yes. 'query_sparql' allows you to execute formal graph queries against defined ontologies, enabling you to connect related data points that standard dataset views might separate.

**What is the difference between list_datasets and search_datasets?**
Use 'list_datasets' for a comprehensive inventory of all available packages. Use 'search_datasets' when you know keywords (like 'tourism') and want to narrow down which specific datasets match that topic.

**Do I need an API key to preview data using preview_data?**
While sometimes an API key is necessary for certain endpoints, the agent handles the authentication flow. If public access is available, it retrieves a sample of records directly through 'preview_data'.

**How do I determine the exact structure and column types for a view using show_columns?**
It returns a detailed list of every available field in that specific data view. You'll get the column name, its associated data type (like string or integer), and whether it allows null values.

**What information does get_organization provide about data publishers?**
This tool retrieves detailed metadata about the entity publishing the dataset. You can find the organization's full name, a description of its scope, and its role within the region’s open data network.

**If I want to know which datasets are most popular, should I use most_downloaded_datasets?**
Yes. This tool aggregates download statistics across all public records, ranking them by usage frequency. It helps you quickly identify the key data sources that other users rely on.

**How can list_tags help me narrow down my search for specific topics?**
It lists every predefined tag available in the catalog. Use this list to see all possible themes, allowing you to filter massive amounts of data by subject matter before running a full search.

**Can I filter the data preview to see only specific records?**
Yes! Use the `preview_data` tool and provide a JSON string in the `filters` parameter (e.g., `{"entidad": "ARANDA"}`). This allows you to restrict the results to exactly what you need.

**How do I find the structure and data types of a specific view?**
You can use the `show_columns` tool by providing the `view_id`. It will return a detailed list of all columns, their descriptions, and their technical data types.

**Is it possible to search for datasets by keywords or topics?**
Absolutely. Use the `search_datasets` tool with the `q` parameter to perform a Solr search across the entire CKAN catalog for relevant datasets.