# Dades Obertes Catalunya MCP for AI Agents AI Agent Connect

> Dades Obertes Catalunya MCP gives your AI agent direct access to the official open data portal of the Government of Catalonia. Use it to search for public datasets and run SoQL queries to pull specific information on health, transport, and demographics without manual downloads.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_PIJE31NJ9LRwIstSjU8dzQZGTHyZrJ2KCl4ZR7G9/ai-agent-connect
- **Tags:** open-data, public-sector, dataset-discovery, soql, catalonia-data, administrative-data

## Description

Imagine you're trying to find specific public statistics about hospital locations or transport infrastructure in Catalonia. Usually, that involves hunting through government websites, downloading CSV files, and then trying to filter everything in a spreadsheet. This Connector changes that. It lets your AI agent do the heavy lifting for you. You can just ask your agent to find a specific dataset and pull out exactly what you need. If you're looking for economic trends or urban planning data, the agent can scan the catalog and run queries to get the numbers. It handles the technical side of the query language so you don't have to learn the syntax yourself. You can sort the results, filter by specific criteria like population size, or group data to see bigger trends. It's a way to turn a massive public database into a conversational tool. When you connect this through the Vinkius catalog, you get a direct line to thousands of public records. Instead of wrestling with data exports, you just get the answers you need in your existing workspace.

## Tools

### query_dataset
Run specific SoQL queries to filter, select, and sort data from a dataset. This lets you get precise records like population counts or facility locations.

### search_catalog
Search the entire Dades Obertes Catalunya catalog for dataset identifiers. Use this to find the right data source before you start querying.

## Prompt Examples

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

**Response:** 
```
I found several datasets. The most relevant is 'Centres sanitaris de Catalunya' with ID `8u93-v9az`. Would you like me to query its first few records?
```

**Prompt:** 
```
Query dataset 'abcd-1234' and show me the top 5 results where population is over 10000.
```

**Response:** 
```
Using query parameters for population > 10000 and a limit of 5... Here are the results:

| City | Population |
| :--- | :--- |
| Barcelona | 1.6M |
| L'Hospitalet | 264k |
| Terrassa | 223k |
```

**Prompt:** 
```
List the columns available in dataset 'xyz1-2345' using a full-text search for 'electric'.
```

**Response:** 
```
I've queried the dataset with a search for 'electric'. I found records related to electric vehicle charging stations, including columns for:

*   **location**
*   **power_kw**
*   **status**
```

## Capabilities

### Find specific public datasets
Search the official catalog using keywords to identify the exact data you need.

### Filter data with SoQL
Pull specific records by applying filters, selections, and limits to any dataset.

### Identify economic trends
Group and sort results to find patterns in regional data like transport or health.

### Perform full-text searches
Scan entire datasets for specific keywords like 'electric' or 'hospital'.

### Handle large data exports
Use built-in limits and offsets to browse through thousands of records systematically.

## Use Cases

### Finding hospital locations
A researcher asks the agent to search the catalog for 'centres sanitaris' and list the locations. The agent finds the ID and pulls the records instantly.

### Filtering city populations
A data analyst wants to see the top 10 cities with over 50,000 residents. They ask the agent to query the population dataset with a filter and limit.

### Exploring API structures
A developer needs to see what columns are available in a transport dataset. They ask the agent to list the fields for a specific identifier.

### Locating charging stations
An urban planner needs to see all electric vehicle charging stations. They ask the agent to perform a full-text search for 'electric' in the transport data.

## Benefits

- Skip the manual CSV downloads by having your agent pull data directly into your workspace using query_dataset.
- Find relevant government records quickly using search_catalog instead of browsing through complex web portals.
- Use precise filters to isolate specific criteria like population size or location without writing code.
- Analyze trends in health, transport, and the economy by grouping data through simple conversational prompts.
- Get accurate results from large datasets by using built-in limits and offsets to browse records systematically.
- Reduce time spent on data cleaning by getting only the specific rows you need directly from the source.

## How It Works

The bottom line is you get instant, conversational access to Catalonia's official public data records.

1. Subscribe to the Dades Obertes Catalunya MCP
2. Add your Socrata App Token to your settings for higher request limits
3. Ask your AI client to find and query Catalan public data

## Frequently Asked Questions

**What datasets can I access with the Dades Obertes Catalunya MCP?**
You can access thousands of public datasets from the official Government of Catalonia portal, covering topics like health, transport, and demographics.

**Can I filter the results for specific regions or numbers?**
Yes, you can use natural language to ask the agent to filter by specific criteria like population size or location using SoQL.

**Do I need to know SoQL to use this?**
No, you don't need to learn any code. You just tell your AI client what you want to see, and the Connector handles the query language for you.

**How do I get higher request limits?**
You can provide your Socrata App Token in the configuration settings to increase your rate limits for more frequent queries.

**Can this Connector help with research on urban planning?**
It's perfect for that. You can search for specific infrastructure data and pull it directly into your research workflow.

**Is this the same as downloading CSVs from the portal?**
It's much faster. Instead of downloading a file and opening it, your agent pulls only the specific rows you need.

**How do I find the unique identifier for a specific dataset?**
Use the `search_catalog` tool with a descriptive query. The response will include the 4x4 alphanumeric ID (e.g., 'abcd-1234') which you can then use with the `query_dataset` tool.

**Can I filter data by specific values like a city or a date range?**
Yes! When using `query_dataset`, use the `$where` parameter to apply SoQL filters. For example, `$where: "poblacio > 5000"` or `$where: "comarca = 'Barcelonès'"`.

**Is a Socrata App Token mandatory to use this server?**
No, it is optional. However, providing a `DADES_APP_TOKEN` allows for higher rate limits and prevents throttling during intensive data exploration.