Skip to main content
Glama
3a3

Fujitsu Social Digital Twin MCP Server

by 3a3

get_metrics

Retrieve comprehensive metrics and analytics from a completed simulation, including travel statistics, emissions data, and traffic flow information.

Instructions

Retrieves comprehensive metrics and analytics data from a completed simulation, including travel statistics, emissions data, and traffic flow information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
simulation_idYes
ctxNo

Implementation Reference

  • MCP tool handler for get_metrics. Decorated with @mcp.tool(), this is the main entry point that retrieves comprehensive metrics and analytics data from a completed simulation, including travel statistics, emissions data, and traffic flow information.
    @mcp.tool()
    async def get_metrics(simulation_id: str, ctx: Optional[Context] = None) -> Dict[str, Any]:
        """Retrieves comprehensive metrics and analytics data from a completed simulation, including 
        travel statistics, emissions data, and traffic flow information."""
        try:
            if not simulation_id:
                return format_api_error(400, "simulationId required")
            
            async with await get_http_client() as client:
                api_client = FujitsuSocialDigitalTwinClient(client)
                result = await api_client.get_metrics(simulation_id)
            return result
        except Exception as e:
            logger.error(f"Metrics retrieval error: {e}")
            return format_api_error(500, str(e))
  • Registration of get_metrics as an MCP tool via @mcp.tool() decorator on line 488.
    @mcp.tool()
  • FujitsuSocialDigitalTwinClient.get_metrics() - API client method that calls GET /api/metrics/{simulation_id} to fetch metrics data from the backend API.
    async def get_metrics(self, simulation_id: str) -> Dict[str, Any]:
        try:
            response = await self.client.get(f"/api/metrics/{simulation_id}")
            response.raise_for_status()
            return format_simulation_result(response.json())
        except httpx.HTTPStatusError as e:
            logger.error(f"Metrics retrieval error: {e}")
            return format_api_error(e.response.status_code, str(e))
        except Exception as e:
            logger.error(f"Unexpected error retrieving metrics: {e}")
            return format_api_error(500, str(e))
  • Function signature showing input parameter (simulation_id: str) and return type (Dict[str, Any]). The docstring describes the tool's purpose.
    @mcp.tool()
    async def get_metrics(simulation_id: str, ctx: Optional[Context] = None) -> Dict[str, Any]:
  • analyze_traffic_simulation tool uses get_metrics internally to fetch metrics data for analysis.
    @mcp.tool()
    async def analyze_traffic_simulation(simulation_id: str, region: str = "unknown", 
                                   scenario: str = "unknown", time_range: str = "unknown",
                                   ctx: Optional[Context] = None) -> Dict[str, Any]:
        """Conducts comprehensive analysis on simulation results, providing insights on traffic patterns, 
        bottlenecks, and optimization opportunities for the specified parameters."""
        try:
            if not simulation_id:
                return format_api_error(400, "simulationId required")
            
            async with await get_http_client() as client:
                api_client = FujitsuSocialDigitalTwinClient(client)
                metrics_result = await api_client.get_metrics(simulation_id)
  • compare_scenarios tool uses get_metrics internally twice to fetch metrics for two scenarios being compared.
    @mcp.tool()
    async def compare_scenarios(simulation_id1: str, simulation_id2: str, 
                         scenario1_name: str = "Scenario 1", scenario2_name: str = "Scenario 2",
                         ctx: Optional[Context] = None) -> Dict[str, Any]:
        """Performs detailed comparative analysis between two simulation scenarios, highlighting differences 
        in traffic flow, emissions, travel times, and other key metrics."""
        try:
            if not simulation_id1 or not simulation_id2:
                return format_api_error(400, "Two simulation IDs required")
            
            async with await get_http_client() as client:
                api_client = FujitsuSocialDigitalTwinClient(client)
                metrics_result1 = await api_client.get_metrics(simulation_id1)
                metrics_result2 = await api_client.get_metrics(simulation_id2)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the tool retrieves data. It does not disclose behavioral traits like whether the operation is read-only, has side effects, requires specific permissions, or any rate limits. For a data retrieval tool, at minimum a read-only hint is expected.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the core purpose. It could be improved by adding more detail without becoming verbose, but as it stands it is efficient and clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, no annotations, and 0% parameter coverage, the description is too minimal. It does not specify the exact metrics returned, any constraints on the simulation state, or how to interpret the output. A more complete description would include expected return format or examples.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the description adds no explanation for the two parameters. The required 'simulation_id' parameter is not described at all, and the optional 'ctx' parameter is only defined in the schema's $defs. The description fails to add meaning beyond the schema's basic type information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves comprehensive metrics from completed simulations, listing specific data types (travel statistics, emissions, traffic flow). This distinguishes it from siblings like 'list_simulations' or 'start_simulation', though it does not explicitly contrast with similar data-retrieval tools like 'get_simdata'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'analyze_traffic_simulation' or 'get_simulation_result'. The description gives no hints about prerequisites, whether the simulation must be completed, or what distinguishes this from sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/3a3/fujitsu-sdt-mcp'

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