Skip to main content
Glama

get_heroes

Retrieve comprehensive Dota 2 hero data including names, attributes, and basic statistics for game analysis and strategy planning.

Instructions

Get list of all Dota 2 heroes.

Returns: List of all heroes with basic information

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • Handler and registration for the get_heroes tool. This async function fetches the list of all Dota 2 heroes from the OpenDota API endpoint '/heroes', sorts them by ID, and formats a string response with each hero's name, ID, primary attribute, attack type, and roles. Registered using the @mcp.tool() decorator which also infers the schema from the function signature and docstring.
    @mcp.tool() async def get_heroes() -> str: """Get list of all Dota 2 heroes. Returns: List of all heroes with basic information """ heroes_data = await make_opendota_request("heroes") if "error" in heroes_data: return f"Error retrieving heroes data: {heroes_data['error']}" if not heroes_data or not isinstance(heroes_data, list) or len(heroes_data) == 0: return "No heroes data found." # Sort by hero ID sorted_heroes = sorted(heroes_data, key=lambda x: x.get("id", 0)) formatted_heroes = [] for hero in sorted_heroes: hero_id = hero.get("id", 0) name = hero.get("localized_name", f"Hero {hero_id}") primary_attr = hero.get("primary_attr", "Unknown") attack_type = hero.get("attack_type", "Unknown") roles = ", ".join(hero.get("roles", [])) formatted_heroes.append( f"{name} (ID: {hero_id})\n" f"Primary Attribute: {primary_attr}\n" f"Attack Type: {attack_type}\n" f"Roles: {roles}" ) return "Dota 2 Heroes:\n\n" + "\n\n".join(formatted_heroes)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/asusevski/opendota-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server