Skip to main content
Glama

get_character_profile

Retrieve detailed character profile information from Wuthering Waves in Markdown format by providing the character's Chinese name.

Instructions

获取库街区上的角色档案信息并以 Markdown 格式返回。

    Args:
        character_name: 要查询的角色的中文名称。

    Returns:
        包含角色档案信息的 Markdown 字符串,
        或者在找不到角色或获取数据失败时返回错误消息。
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
character_nameYes

Implementation Reference

  • Primary handler function for the 'get_character_profile' MCP tool, registered with @mcp.tool(). Proxies the call to the character service after basic error handling.
    @mcp.tool()
    async def get_character_profile(character_name: str) -> str:
        """获取库街区上的角色档案信息并以 Markdown 格式返回。
    
        Args:
            character_name: 要查询的角色的中文名称。
    
        Returns:
            包含角色档案信息的 Markdown 字符串,
            或者在找不到角色或获取数据失败时返回错误消息。
        """
        try:
            character_service, _ = get_services()
            return await character_service.get_character_profile(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 class. Retrieves raw character data from repository, parses the profile content, generates Markdown output, and handles errors appropriately.
    async def get_character_profile(self, character_name: str) -> str:
        """Get character profile information only.
    
        Args:
            character_name: Name of the character to query.
    
        Returns:
            Markdown formatted character profile.
    
        Raises:
            ServiceException: If character profile retrieval fails.
        """
        try:
            self.logger.info(f"Getting character profile for: {character_name}")
    
            # Get character raw data
            character_raw_data = await self._get_character_data(character_name)
    
            # Parse profile content
            character_profile_data = await asyncio.to_thread(
                self.content_parser.parse_character_profile, character_raw_data
            )
    
            # Generate markdown
            profile_markdown = self.markdown_service.generate_character_markdown(
                character_profile_data, include_strategy=False
            )
    
            if not profile_markdown.strip():
                self.logger.warning(f"Generated empty profile for: {character_name}")
                return f"成功获取 '{character_name}' 的档案数据,但解析后的内容无法生成有效的 Markdown。"
    
            self.logger.info(f"Successfully generated character profile for: {character_name}")
            return profile_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 profile for {character_name}: {e}")
            raise ServiceException(f"Character profile retrieval failed: {e}")
  • Type signature definition in CharacterServiceProtocol interface, defining the expected input (str character_name) and output (str) for the method.
    async def get_character_profile(self, character_name: str) -> str:
        """Get character profile 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