# Valencia Open Data MCP

> Gobierno Abierto Valencia connects your AI agent directly to the official city data portal. Use this MCP to query public datasets, inspect resource metadata, and search actual records from Valencia's open data resources using natural conversation.

## Overview
- **Category:** knowledge-management
- **Price:** Free
- **Tags:** open-data, municipal-data, public-records, dataset-discovery, valencia, data-portal

## Description

This connection lets you treat Valencia’s massive collection of civic and municipal data like a simple database lookup. Instead of navigating dozens of web pages or downloading ZIP files just to find one number, you talk to your agent. It finds the right dataset—whether it's public transit schedules or historical spending records—and gives you the details without manual effort. You can ask about specific groups of data or search deep inside a resource’s actual record set using simple questions. When you connect this MCP through Vinkius, you get immediate access to thousands of other specialized tools alongside Valencia’s open data, all managed in one place.

## Tools

### search_datastore
Searches for actual records within a resource’s data store using filters or keywords.

### list_groups
Retrieves a list of high-level organizational groups or categories for the datasets.

### show_package
Gets detailed metadata for a specific dataset, including all its resources.

### list_packages
Lists all available dataset names that you can query.

### show_resource
Retrieves deep information on a single file, detailing its structure and format.

## Prompt Examples

**Prompt:** 
```
List all available datasets in the Valencia portal.
```

**Response:** 
```
I've retrieved the list of datasets. There are several available, including 'Tráfico', 'EMT Valencia', and 'Presupuestos Municipales'. Which one would you like to explore?
```

**Prompt:** 
```
Search for 'bicis' records in resource ID 456.
```

**Response:** 
```
Searching the datastore... I found 10 records matching 'bicis'. These include real-time station availability and location data. Would you like to see the specific coordinates?
```

**Prompt:** 
```
Show me the details for the dataset 'EMT Valencia'.
```

**Response:** 
```
Fetching metadata for 'EMT Valencia'... This dataset contains real-time bus information, routes, and schedules. It includes 5 resources (CSV, JSON, and GeoJSON formats).
```

## Capabilities

### Find available datasets and groups
List the entire inventory of public data packages or narrow down the search by thematic category.

### Check dataset details
Retrieve full metadata for a specific dataset, showing all its included resources and formats.

### Inspect resource structure
Examine the internal file format, data types, and descriptions of any given resource within a package.

### Search specific records
Run advanced queries against the actual stored data points inside a resource using filters or keywords.

## Use Cases

### Finding Transit Schedule Data
A developer needs real-time bus schedules for a new app feature. Instead of searching the Valencia website's documentation, they ask their agent to list packages and then use `show_package` to pinpoint the correct dataset, ensuring it supports GeoJSON format.

### Verifying Historical Budgets
A researcher wants to see how much money was allocated to parks in 2018. They use `list_groups` to find 'Budget' records, then run a targeted query with `search_datastore` filtering by year and department.

### Checking Data Integrity
A data analyst finds a dataset but isn't sure if it has location data. They use `show_resource` to inspect the metadata, confirming that the available format includes latitude and longitude fields before committing to analysis.

### Discovering Relevant Data Sources
A citizen wants general information on all municipal transparency records. They start by asking the agent to list groups; this quickly narrows their focus from 'everything' to specific thematic categories.

## Benefits

- Skip manual browsing. Instead of clicking through multiple tabs, you ask the agent to list all available datasets or narrow down results by group using `list_groups` or `list_packages`.
- Understand data structure instantly. Use `show_resource` to check if a dataset contains GPS coordinates or time stamps before attempting to search it.
- Run complex searches without code. The `search_datastore` tool lets you filter records using natural language, finding specific information like 'all buses on route 12' immediately.
- Drill down efficiently. After identifying a package with `show_package`, you can see all the different resources it holds (CSV, JSON, etc.) and pick exactly what you need.
- Save time on data discovery. You get to skip the tedious process of manually correlating dataset names with their actual content by using this single MCP connection.

## How It Works

The bottom line is, you get direct conversational access to structured public data without writing any API calls yourself.

1. Subscribe to this MCP and provide your Valencia Open Data API Key, if required for certain datasets.
2. Instruct your AI client to list the available groups or packages you want to explore.
3. Ask the agent to search a specific resource using filters (e.g., 'show me all records matching X') and receive the results.

## Frequently Asked Questions

**How do I start looking at all available datasets using list_packages?**
You simply ask your agent to use `list_packages`. This returns a comprehensive list of every official dataset name, which is the first step in knowing what data exists on the portal.

**What if I need to find records within a specific dataset? Should I use search_datastore?**
Yes, that's right. Use `search_datastore`. It lets you run powerful queries against the actual content of the resource, allowing you to filter by keywords or criteria.

**Do I need to know what group a dataset belongs to? Can list_groups help?**
Using `list_groups` is helpful because it organizes the data. Instead of looking at thousands of datasets, you can filter them immediately by thematic categories like 'Traffic' or 'Health'.

**Is show_resource always necessary before searching?**
It’s highly recommended. `show_resource` confirms the specific file format and field names within a dataset, preventing failures when you try to use `search_datastore`.

**How do I get the full metadata for a specific dataset using show_package?**
It pulls all necessary metadata, giving you an overview of the data structure and formats before you start querying. This shows you available fields (columns) and resource types within that package.

**What kind of filtering can I apply when running a query with search_datastore?**
You can apply powerful filters, date ranges, and multiple criteria simultaneously. This lets your agent narrow down records without needing to download the entire dataset first.

**What happens if my AI client calls any tool without a valid API Key?**
The call fails immediately with an authentication error. You must ensure your agent is provided the correct, active Valencia Open Data API key for successful data retrieval from this MCP.

**If I'm looking for public records in a niche category, should I use list_groups first?**
Yes, that’s the best starting point. By listing groups, you narrow down the scope quickly, helping your agent focus on relevant datasets and saving time.

**How do I search for specific records within a data file?**
Use the `search_datastore` tool with the specific Resource ID. You can provide a search string `q` to filter the records and use `limit` or `offset` for pagination.

**How can I see the metadata for a specific dataset?**
Simply use the `show_package` tool and provide the name or ID of the dataset. The agent will return full metadata including descriptions, maintainers, and associated resources.

**Can I list all the data categories available in the portal?**
Yes! The `list_groups` tool returns all dataset groups or categories available in the Valencia Open Data portal, helping you browse by topic.