get_performance_stats
Retrieve performance metrics and statistics for image processing operations to monitor efficiency and optimize workflows.
Instructions
获取性能统计信息
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_performance_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- main.py:793-806 (handler)MCP tool handler and registration for 'get_performance_stats'. Calls the utility function from utils.performance and formats the result as a JSON string.
@mcp.tool() def get_performance_stats() -> str: """获取性能统计信息""" try: stats = utils_get_performance_stats() return json.dumps({ "success": True, "data": stats }, ensure_ascii=False, indent=2) except Exception as e: return json.dumps({ "success": False, "error": f"获取性能统计失败: {str(e)}" }, ensure_ascii=False, indent=2) - utils/performance.py:351-358 (helper)Core helper function that aggregates performance statistics from global monitor, cache, and resource manager instances.
def get_performance_stats() -> Dict[str, Any]: """获取完整的性能统计""" return { "monitor": performance_monitor.get_stats(), "cache": image_cache.get_stats(), "resources": resource_manager.get_stats(), "timestamp": time.time() } - main.py:85-85 (registration)Import of the performance stats utility function used by the MCP tool handler.
from utils.performance import get_performance_stats as utils_get_performance_stats, reset_performance_stats as utils_reset_performance_stats