get_cast
Retrieve complete cast information for any movie using its IMDb ID to identify actors and their roles in the film.
Instructions
Get the cast of a movie from IMDb. Args: imdbId: The IMDb ID of the movie to get cast for. Returns: JSON object containing the cast of the movie.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| imdb_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"imdb_id": {
"title": "Imdb Id",
"type": "string"
}
},
"required": [
"imdb_id"
],
"type": "object"
}
Implementation Reference
- src/imdb_mcp_server/tools.py:116-128 (handler)Handler function for the 'get_cast' tool. Decorated with @mcp.tool() which registers it as an MCP tool. It constructs the API URL, calls make_imdb_request to fetch cast data for the given IMDb ID, and returns the JSON response or an error message.@mcp.tool() async def get_cast(imdb_id: str, ctx: Context) -> str: """Get the cast of a movie from IMDb. Args: imdbId: The IMDb ID of the movie to get cast for. Returns: JSON object containing the cast of the movie. """ cast_url = f"{BASE_URL}/{imdb_id}/cast" cast_data = await make_imdb_request(cast_url, {}, ctx) if not cast_data: return "Unable to fetch cast data for this movie or movie not found." return json.dumps(cast_data, indent=4)