# TheMealDB Extended MCP

> TheMealDB Extended connects your AI agent to a massive global recipe database. You can find meal ideas by ingredients you have on hand, filter dishes by country or cuisine type, and retrieve full cooking instructions using unique IDs. It's basically an instant sous-chef for your prompts.

## Overview
- **Category:** knowledge-management
- **Price:** Free
- **Tags:** recipes, cooking, culinary-database, meal-planning, ingredients

## Description

Listen up. When you connect your AI agent to TheMealDB Extended, you're hooking it up to a massive recipe database—like having an instant sous-chef right in your chat window. This isn't just another search box; the server gives your agent specific tools so it can talk directly to the food data. You don't ask one big question and hope for the best; you run precise commands, making sure you get exactly what you need.

**Finding Meals by Geography and Type**

Need an idea based on where you are or what kind of meal it is? The server lets your agent narrow things down fast. You can use `list_areas` to pull a simple list of every country or big region in the database, then `filter_by_area` to restrict results—say, only dishes from Italy. If geography isn't enough, you can check out what kind of food groups are available by calling `list_categories`, and then use `filter_by_category` to limit your search to something specific like 'Seafood' or 'Dessert'. You also don't have to guess; the tool `list_all_categories` gives you a full rundown of every single meal category they track. Need to know what ingredients are even in there? Use `list_ingredients`—it spits out a browsable list of common pantry items.

**Filtering Dishes by Ingredients**

This is the killer feature: Forget trying to remember a recipe name. You just tell your agent which main components you've got lying around, and it finds recipes using those ingredients. The `filter_by_ingredient` tool searches for meals based on one or more specific items you list. It bypasses the need for knowing any recipe names at all.

**Retrieving Full Recipe Details**

If your agent finds a meal it likes, getting the details is simple. You can use `get_meal_by_id` to look up every single piece of info—the full ingredient list, measurements, and step-by-step instructions—using that unique Meal ID number. Need something quick? Use `get_random_meal` for one dish or `get_random_meals_selection` if you want a set of ten totally random ideas. If you're just testing the waters, your agent can always call `get_latest_meals` (you gotta have Premium V2 for that one) to see what dishes were added most recently.

**Browsing the Database Structure and Searching Names**

The server gives you a ton of ways to explore. If you want to search by name, use `search_meals_by_name` to check against recipes matching either all or part of a string you give it. For more targeted browsing, your agent can call `list_meals_by_first_letter`, which lists every meal available that starts with a specific letter (A through Z). You also have tools like `get_random_meal` and `get_random_meals_selection` so you don't get stuck—you always got options.

Basically, whether you wanna find dishes from Vietnam using chicken and rice, or you just wanna see what random dessert is available today, your agent has the tools to make it happen. It’s a complete system that lets you drill down into any kind of culinary data.

## Tools

### filter_by_area
Narrows down recipes by selecting a specific country or geographical region.

### filter_by_category
Limits the meal results to a selected food group, like 'Dessert' or 'Seafood'.

### filter_by_ingredient
Finds recipes that contain one or more specific ingredients you list.

### get_latest_meals
Retrieves a list of the most recently added dishes in the database (Premium V2 required).

### get_meal_by_id
Looks up and returns all detailed information for one meal using its unique ID number.

### get_random_meal
Returns the full details of a single, random recipe from the entire database.

### get_random_meals_selection
Retrieves a selection of 10 unique random meals (Premium V2 required).

### list_all_categories
Returns a full list of all recognized meal categories and their descriptions.

### list_areas
Provides a simple, browsable list of countries or major geographic regions.

### list_categories
Lists all available meal categories for easy browsing and filtering.

### list_ingredients
Provides a simple, browsable list of common ingredients used in recipes.

### list_meals_by_first_letter
Lists all available meals that start with a specific letter (A-Z).

### search_meals_by_name
Searches the database for recipes matching a full or partial name string.

## Prompt Examples

**Prompt:** 
```
Search for a recipe named 'Teriyaki Chicken'.
```

**Response:** 
```
I found a recipe for Teriyaki Chicken (ID: 52773). It's a Japanese dish. Would you like the full instructions and ingredients?
```

**Prompt:** 
```
List all available meal categories.
```

**Response:** 
```
I've retrieved the categories. You can choose from Beef, Chicken, Dessert, Lamb, Miscellaneous, Pasta, Pork, Seafood, Side, Starter, Vegan, Vegetarian, Breakfast, and Goat.
```

**Prompt:** 
```
Show me some recipes from the 'Canadian' area.
```

**Response:** 
```
I found several Canadian dishes, including BeaverTails, Poutine, Nanaimo Bars, and Tourtiere. Which one would you like to explore?
```

## Capabilities

### Find meals by geography and type
List all available meal categories or filter recipes based on a specific country or region.

### Filter dishes by ingredients
Search for recipes using one or more main components you have in your pantry, bypassing the need to know the recipe name.

### Retrieve full recipe details
Look up a single meal's complete instructions and ingredient list using its unique Meal ID.

### Browse database structure
List all available categories, areas, or ingredients to understand what filters your agent can use next.

## Use Cases

### The Fridge Raid
A user opens the chat with: 'I have chicken, rice, and soy sauce. What can I make?' The agent calls `list_ingredients` to confirm 'chicken' is valid, then runs `filter_by_ingredient` using those three items. It returns a list of possible recipes.

### The Global Blogger
A content creator needs 10 ideas for an article on Asian cuisine. They ask the agent to use `list_areas` and then run `filter_by_area` specifically for 'Japanese'. The agent returns a list of dishes they can write about.

### The Targeted Search
A developer needs all desserts from Italy. They call `list_categories` to confirm 'Dessert' is valid, then run `filter_by_category`, and finally refine that result by calling `filter_by_area` for 'Italy'.

### The Quick Reference
A user knows a recipe ID (52773) but can't remember the name. They just pass the ID to the agent, which executes `get_meal_by_id` and prints out the full instructions instantly.

## Benefits

- Stop guessing what to cook. Use `list_ingredients` and then pass that list into `filter_by_ingredient`. Your agent immediately gives you a curated set of dishes using only what's in your pantry.
- Never get stuck on cuisine type again. Run `list_categories` first, then use `filter_by_category` to narrow down the results—whether you’re looking for 'Pasta' or 'Vegan'.
- Need a quick idea? Call `get_random_meal`. You instantly get a full recipe, measurements included, without having to search anything.
- If you only have an ID number (maybe from a previous search), use `get_meal_by_id`. It bypasses all the searching and pulls up the entire dish record directly.
- Build robust client logic. The listing tools (`list_areas`, `list_categories`) let your agent build filters programmatically, giving you complete control over data filtering.

## How It Works

The bottom line is you’re chaining specialized API calls together: list options -> filter parameters -> retrieve data.

1. First, tell the agent what you want to narrow down. You'll need to run a listing tool like `list_categories` to see available options.
2. Next, use one of the filtering tools—for example, if you know it's a pasta dish and from Italy, you'd call `filter_by_category` then `filter_by_area`.
3. Finally, pass the results or specific filters into a retrieval tool like `get_meal_by_id` to get the full recipe details.

## Frequently Asked Questions

**How do I find recipes using the TheMealDB Extended MCP Server?**
You start by listing what's available. Run `list_categories` to see if 'Dessert' is a valid filter, then use `filter_by_category('Dessert')`.

**Can TheMealDB Extended MCP Server search by multiple ingredients?**
Yes, the `filter_by_ingredient` tool accepts comma-separated values for V2 premium users. You just list them out: 'chicken, rice, soy sauce'.

**What is the difference between `get_random_meal` and `get_random_meals_selection`?**
`get_random_meal` gives you one full recipe. `get_random_meals_selection` (Premium V2) gives you a curated list of 10 random recipes to choose from.

**How do I find all possible filter options for TheMealDB Extended MCP Server?**
You run the listing tools: `list_areas` shows countries, while `list_categories` shows meal types. They give you the required inputs for filtering.

**What key do I need to successfully use `get_latest_meals` with TheMealDB Extended MCP Server?**
You require a premium V2 API key. If you try to run this tool without the correct credentials, the server will reject the request and return an authentication error. Always check your subscription status for premium features.

**If I use `get_meal_by_id` in TheMealDB Extended MCP Server but provide a meal ID that doesn't exist, what happens?**
The tool handles invalid inputs gracefully. Instead of crashing, the server will return an error message or an empty set of results, letting your agent know the requested ID is not found in the database.

**When using `filter_by_ingredient` with TheMealDB Extended MCP Server, how should I structure a list of multiple ingredients?**
For premium V2 users, you must separate multiple ingredients by commas. For example, use 'chicken, tomato, oregano' instead of listing them one after the other.

**How can TheMealDB Extended MCP Server help me explore all global cuisine types?**
You first call `list_areas` to get a comprehensive list of regions and countries. Then, you pass those specific areas into the `filter_by_area` tool for targeted results.

**How do I get the full cooking instructions for a specific meal?**
Use the `get_meal_by_id` tool with the unique Meal ID. The agent will return the full recipe, including step-by-step instructions and a complete list of ingredients with measurements.

**Can I search for recipes based on what I have in my fridge?**
Yes! You can use the `filter_by_ingredient` tool to find meals that feature a specific main ingredient. For Premium V2 users, you can even provide a comma-separated list of multiple ingredients.

**What is the difference between the free and premium API access?**
The free tier (API key '1') allows standard searching and filtering. Premium V2 access enables advanced tools like `get_latest_meals`, `get_random_meals_selection` (10 at once), and multi-ingredient filtering.