get_person_details
Retrieve detailed information about a specific person or company by providing their unique ID using this tool on the Bangumi TV MCP Service.
Instructions
Get details of a specific person or company.
Args:
person_id: The ID of the person/company.
Returns:
Formatted person details or an error message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| person_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"person_id": {
"title": "Person Id",
"type": "integer"
}
},
"required": [
"person_id"
],
"title": "get_person_detailsArguments",
"type": "object"
}
Implementation Reference
- main.py:1172-1236 (handler)The core handler function for the 'get_person_details' tool, decorated with @mcp.tool(). It retrieves person details from the Bangumi API using make_bangumi_request, handles errors, parses the response, and formats a detailed string output including name, type, summary, careers, gender, birth date, stats, and image.@mcp.tool() async def get_person_details(person_id: int) -> str: """ Get details of a specific person or company. Args: person_id: The ID of the person/company. Returns: Formatted person details or an error message. """ response = await make_bangumi_request(method="GET", path=f"/v0/persons/{person_id}") error_msg = handle_api_error_response(response) if error_msg: return error_msg # Expecting a dictionary if not isinstance(response, dict): return f"Unexpected API response format for get_person_details: {response}" person = response infobox = person.get("infobox") details_text = f"Person Details (ID: {person_id}):\n" details_text += f" Name: {person.get('name')}\n" person_type_int = person.get("type") person_type_str = "Unknown Type" if person_type_int is not None: try: person_type_str = PersonType(person_type_int).name except ValueError: person_type_str = f"Unknown Type ({person_type_int})" details_text += f" Type: {person_type_str}\n" details_text += f" Summary:\n{person.get('summary')}\n" details_text += f" Locked: {person.get('locked')}\n" details_text += f" Careers: {', '.join(person.get('career') or [])}\n" if person.get("gender"): details_text += f" Gender: {person.get('gender')}\n" if person.get("blood_type") is not None: try: details_text += ( f" Blood Type: {BloodType(person.get('blood_type')).name}\n" ) except ValueError: details_text += f" Blood Type: Unknown ({person.get('blood_type')})\n" if person.get("birth_year"): details_text += f" Birth Date: {person.get('birth_year')}-{person.get('birth_mon')}-{person.get('birth_day')}\n" if infobox: details_text += ( " Infobox: (Details available in raw response, potentially complex)\n" ) stat = person.get("stat", {}) details_text += f" Comments: {stat.get('comments', 0)}, Collections: {stat.get('collects', 0)}\n" images = person.get("images") if images and images.get("large"): details_text += f" Image: {images.get('large')}\n" return details_text