# Trefle MCP

> Trefle connects your AI client to a massive botanical database containing over 1 million plant entries. Use Trefle tools to search for specific plants or species, trace taxonomic hierarchies (genera and sub-taxa), and check detailed geographic distribution data. It’s the deep dive you need when manual database queries aren't cutting it.

## Overview
- **Category:** knowledge-management
- **Price:** Free
- **Tags:** botany, plant-database, taxonomy, biodiversity, scientific-data

## Description

**Trefle connects your AI client directly into a massive botanical database, giving you hands-on control over over a million plant entries.** You're looking for more than just surface-level data; you need the deep dive when standard queries fall short. This server lets you search specific species and genera, trace complex taxonomy, and map detailed geographic distribution patterns using twelve dedicated tools.

**Finding Plants and Species Data**

You can start by running `search_species` to query all recorded species and sub-taxa using natural language—you just tell it what you're looking for. If you need a broader search across the main plant group, use `search_plants` instead; this performs keyword searches against all primary plant records. For comprehensive browsing, you can pull a full list of every known species or sub-taxa by calling `list_species`, while `list_plants` gives you an inventory of only the main plant species, filtering out varieties and subspecies forms.

**Retrieving Scientific Profiles**

When you pinpoint what you need, Trefle lets you pull full scientific profiles. To get all the metadata for a single, known plant species, run `get_species` to fetch its complete details, including its taxonomy notes. If you know the specific identifier of a plant, use `get_plant` to retrieve its full scientific profile and associated data. For deeper taxonomic context, calling `get_genus` pulls detailed information for one specific genus using just its identifier.

**Mapping Taxonomy and Structure**

To map out the entire botanical kingdom’s structure, you can pull a complete list of all cataloged plant genera by invoking `list_genera`. If you need to know what global distribution zones exist in the database at all, run `list_distributions` to generate that full inventory. Once you have a zone listed, you use `get_distribution_plants` to filter records and see which plants were established there, letting you specifically filter by status—like finding only 'native' species within that defined area.

**Handling Data Corrections**

The database isn't perfect. If you find something wrong with the recorded data, Trefle gives you tools to fix it. You can submit a structured correction when an error exists in species information using `submit_species_correction`. For general reporting on inaccuracies that need review, use `report_species_error` to detail the problem found within existing records.

**How It Works In Practice**

You're not just viewing data; you're running complex queries. You can first determine all available global distribution zones with `list_distributions`. Then, if you want to know what species are native only to a specific zone, you use `get_distribution_plants` and filter by status. If your research requires tracing the family structure back up through the taxonomy, you'll start by calling `list_genera`, narrow down your focus with `get_genus`, and then pull the final details on an individual species using `get_species`. The sheer depth of this data means you never have to guess where to look; you just tell Trefle what criteria you need it to check.

## Tools

### get_distribution_plants
Filters a list of plants based on their recorded establishment status (e.g., native) within a specified distribution zone.

### get_genus
Retrieves detailed information for one specific genus using its identifier.

### get_plant
Gets the full scientific profile and metadata for a single plant species.

### get_species
Retrieves complete details on one specific species, including its taxonomy and notes.

### list_distributions
Returns a comprehensive list of all known global distribution zones available in the database.

### list_genera
Lists every genus currently cataloged in the botanical database.

### list_plants
Provides a list of all main plant species, excluding varieties or subspecies forms.

### list_species
Lists every recorded species and sub-taxa available in the database for browsing.

### report_species_error
Allows users to submit a report detailing an inaccuracy found in existing species data.

### search_plants
Performs keyword searches across all main plant species records.

### search_species
Searches for specific species or sub-taxa using natural language queries.

### submit_species_correction
Submits a structured data correction when an error is found in recorded species information.

## Prompt Examples

**Prompt:** 
```
Search for 'Lavandula' and show me the results.
```

**Response:** 
```
I found several results for 'Lavandula'. The most prominent is Lavandula angustifolia (English lavender). Would you like to see the full details for this species?
```

**Prompt:** 
```
List the first page of plant genera.
```

**Response:** 
```
I've retrieved the first page of genera. It includes entries like 'Abies', 'Acacia', and 'Acer'. Which one would you like to explore further?
```

**Prompt:** 
```
Get the details for the plant with slug 'rosa-canina'.
```

**Response:** 
```
Fetching data for Rosa canina (Dog rose)... It belongs to the Rosaceae family and was first described in 1753. It is widely distributed across Europe and North Africa.
```

## Capabilities

### Find Plant Details by Slug
Runs `get_plant` to fetch complete scientific data on a single, known plant.

### Search for Species Across the Database
Uses `search_species` to query all species and sub-taxa based on keywords or criteria.

### List All Botanical Genera
Calls `list_genera` to retrieve a complete list of plant genera for browsing taxonomy.

### Check Geographic Distribution Zones
Runs `list_distributions` to generate an inventory of all recognized global distribution zones.

### Determine Plant Status in a Zone
Uses `get_distribution_plants` to list plants found within a specific, defined geographic zone (and filter by status like 'native').

## Use Cases

### Verifying Native Flora
A conservation scientist needs to check if a plant is native to the Mediterranean basin. They run `list_distributions` to identify the correct zone, then they use `get_distribution_plants` and filter by 'native' establishment status. The agent returns a clean list of only local species.

### Deep Taxonomic Dive
A student is researching orchids. They first run `list_genera` to see related groups, then they use `get_genus` on a promising candidate. Finally, they call `search_species` to pull all known sub-taxa under that genus for their paper.

### Data Cleanup and Correction
A developer notices the date for 'Rosa canina' is wrong in a legacy system. Instead of manually patching it, they use `submit_species_correction` to formally submit the accurate data point directly from their AI client.

### Identifying Unknown Species
A field biologist captures photos and knows the plant is in the Rosaceae family. They run `search_plants` with keywords like 'rose' or 'Rosaceae'. The agent surfaces potential matches, which they can then investigate further using `get_plant`.

## Benefits

- Find exact data fast. Instead of digging through multiple tabs, you ask your agent to run `get_plant` using the slug, and you get the full scientific profile immediately.
- Map global biodiversity. Use `list_distributions` to see every zone, then use `get_distribution_plants` to filter that list down to only native species in a target area.
- Understand taxonomy depth. You can start broad by calling `list_genera`, and if you need more detail later, drill down using `get_genus` for the specific family structure.
- Handle dirty data. If you spot an error—say, the wrong year of discovery—you don't have to email a database admin; you run `report_species_error` or `submit_species_correction` directly through your agent.
- Search efficiently. Use `search_plants` for general keywords across main species, or use `search_species` when you know the sub-taxa but aren't sure of the exact name.

## How It Works

The bottom line is: It lets your AI client run complex botanical database queries using natural language prompts.

1. First, you subscribe to the server and provide your Trefle API token.
2. Next, you tell your AI client which specific data point you need (e.g., 'What plants are native to zone X?').
3. The agent runs the appropriate tool (`get_distribution_plants`), pulls the structured data, and gives you the list of species.

## Frequently Asked Questions

**How do I find all the plant genera available? Using list_genera?**
Run `list_genera`. This tool returns a comprehensive index of every genus in the database. It's the best place to start if you don't know which specific group you need.

**What is the difference between search_plants and list_plants?**
`list_plants` gives a simple index of all main species, while `search_plants` lets you use keywords to filter that index. Use the latter if you have partial information.

**Can I check the native status for a plant? Using get_distribution_plants?**
Yes. You must first run `list_distributions` to define your zone, then use `get_distribution_plants`. Make sure you include the filter criteria (e.g., {"filter[establishment]": "native"}).

**How do I submit a data correction? Using submit_species_correction?**
You must use `submit_species_correction`. This requires structured input—you'll need to provide the species ID, the field name, and the corrected value for it to work.

**How do I authenticate or connect before running a command like `get_plant`?**
You must subscribe to the server and enter your Trefle API Token into your AI client. This token authorizes your agent, allowing it to access the botanical database and execute tools like `get_plant`.

**If I spot incorrect data for a species, which tool should I use? Is it `report_species_error`?**
Yes, use `report_species_error`. This tool lets you submit structured reports directly about the faulty data. You provide details on what's wrong and where to find the error.

**Before filtering plants by location using `get_distribution_plants`, how do I see all possible distribution zones?**
Run `list_distributions`. This tool pulls a complete list of every recognized WGSRPD zone. You can then use these specific zone names to filter your searches later.

**What kind of detailed scientific data does the tool give me when I run `get_species`?**
The tool returns a full profile, not just basic identification. Expect metadata like the family name, the year it was first described, and other key botanical slugs.

**Can I search for plants using a simple text query?**
Yes, use the `search_plants` tool. It allows you to find main plant species by providing a query string like 'rose' or 'oak'.

**How can I filter plants by a specific family, like Orchidaceae?**
You can use the `list_plants` tool and provide a JSON string in the `query_params` field, such as `{"filter[family_name]": "Orchidaceae"}`.

**Is it possible to get info on sub-species and varieties?**
Absolutely. While `list_plants` focuses on main species, the `list_species` and `search_species` tools include all sub-taxa, varieties, and hybrids.