Skip to main content
Glama

get_character_info

Retrieve character details from Wuthering Waves including skills and cultivation strategies in Markdown format for game planning and strategy development.

Instructions

获取库街区上的角色详细信息包括角色技能,养成攻略等,并以 Markdown 格式返回。

Args: character_name: 要查询的角色的中文名称。 Returns: 包含角色信息的 Markdown 字符串, 或者在找不到角色或获取数据失败时返回错误消息。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
character_nameYes

Implementation Reference

  • MCP tool handler for 'get_character_info' decorated with @mcp.tool(). It fetches the character service via DI container and delegates execution to it, handling exceptions and returning markdown or error messages.
    @mcp.tool() async def get_character_info(character_name: str) -> str: """获取库街区上的角色详细信息包括角色技能,养成攻略等,并以 Markdown 格式返回。 Args: character_name: 要查询的角色的中文名称。 Returns: 包含角色信息的 Markdown 字符串, 或者在找不到角色或获取数据失败时返回错误消息。 """ try: character_service, _ = get_services() return await character_service.get_character_info(character_name) except (DataNotFoundException, ServiceException) as e: # These exceptions already have user-friendly messages return str(e) except Exception: return f"错误:处理 '{character_name}' 时发生意外错误。请检查服务器日志。"
  • Core business logic implementation in CharacterService. Fetches character data from repository, parses profile and strategy content in parallel, generates combined Markdown output including strategy link if available, handles errors gracefully.
    async def get_character_info(self, character_name: str) -> str: """Get comprehensive character information including strategy. Args: character_name: Name of the character to query. Returns: Markdown formatted character information. Raises: ServiceException: If character retrieval fails. """ try: self.logger.info(f"Getting character info for: {character_name}") # Get character raw data character_raw_data = await self._get_character_data(character_name) # Extract strategy item ID for parallel processing strategy_item_id = self._extract_strategy_item_id(character_raw_data) # Parallel processing: parse profile and fetch strategy profile_task = asyncio.create_task( asyncio.to_thread(self.content_parser.parse_main_content, character_raw_data) ) strategy_task = None if strategy_item_id: strategy_task = asyncio.create_task(self._fetch_strategy_content(strategy_item_id)) # Wait for profile parsing character_profile_data = await profile_task # Generate markdown for profile character_markdown = self.markdown_service.generate_character_markdown( character_profile_data, include_strategy=False ) # Process strategy if available strategy_markdown = "" if strategy_task: try: strategy_raw_data = await strategy_task if strategy_raw_data: strategy_parsed = await asyncio.to_thread( self.content_parser.parse_strategy_content, strategy_raw_data ) strategy_markdown = self.markdown_service.generate_strategy_markdown(strategy_parsed) except Exception as e: self.logger.warning(f"Failed to process strategy content: {e}") # Combine results combined_markdown = character_markdown if strategy_markdown: combined_markdown += "\n\n" + strategy_markdown # Add strategy link if available if strategy_item_id: link_markdown = self._generate_strategy_link_markdown(strategy_item_id) combined_markdown += "\n\n" + link_markdown self.logger.info(f"Successfully generated character info for: {character_name}") return combined_markdown except DataNotFoundException: error_msg = f"Character '{character_name}' not found" self.logger.error(error_msg) return f"错误:未找到名为 '{character_name}' 的角色。" except Exception as e: self.logger.error(f"Failed to get character info for {character_name}: {e}") raise ServiceException(f"Character info retrieval failed: {e}")
  • Manual tool dispatch registration for HTTP transport mode, directly invoking the character service based on tool_name.
    if tool_name == "get_character_info": result = await character_service.get_character_info(arguments.get("character_name"))
  • Input/output schema defined in the tool docstring (character_name: str input, str output).
    """获取库街区上的角色详细信息包括角色技能,养成攻略等,并以 Markdown 格式返回。 Args: character_name: 要查询的角色的中文名称。 Returns: 包含角色信息的 Markdown 字符串, 或者在找不到角色或获取数据失败时返回错误消息。 """
  • Interface/protocol definition for CharacterService.get_character_info.
    async def get_character_info(self, character_name: str) -> str: """Get comprehensive character information.""" ...

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/jacksmith3888/wuwa-mcp-server'

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