get_simdata
Retrieve the complete configuration and parameter set for a simulation dataset, including region settings, time ranges, and scenario parameters, using the dataset ID.
Instructions
Retrieves the complete configuration and parameter set for a specific simulation dataset, including region settings, time ranges, and scenario parameters.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| simdata_id | Yes | ||
| ctx | No |
Implementation Reference
- src/fujitsu_sdt_mcp/server.py:513-527 (handler)The MCP tool handler for 'get_simdata'. Decorated with @mcp.tool(), this async function takes a simdata_id string and optional context, validates the input, creates an API client, calls the underlying API client method, and returns the result or an error.
@mcp.tool() async def get_simdata(simdata_id: str, ctx: Optional[Context] = None) -> Dict[str, Any]: """Retrieves the complete configuration and parameter set for a specific simulation dataset, including region settings, time ranges, and scenario parameters.""" try: if not simdata_id: return format_api_error(400, "simdataId required") async with await get_http_client() as client: api_client = FujitsuSocialDigitalTwinClient(client) result = await api_client.get_simdata(simdata_id) return result except Exception as e: logger.error(f"Simdata retrieval error: {e}") return format_api_error(500, str(e)) - src/fujitsu_sdt_mcp/server.py:133-143 (handler)The API client method that actually performs the HTTP GET request to /api/simdata/{simdata_id}. This is the underlying implementation called by the tool handler.
async def get_simdata(self, simdata_id: str) -> Dict[str, Any]: try: response = await self.client.get(f"/api/simdata/{simdata_id}") response.raise_for_status() return format_simulation_result(response.json()) except httpx.HTTPStatusError as e: logger.error(f"Simulation data retrieval error: {e}") return format_api_error(e.response.status_code, str(e)) except Exception as e: logger.error(f"Unexpected error retrieving simulation data: {e}") return format_api_error(500, str(e)) - src/fujitsu_sdt_mcp/server.py:513-527 (registration)The tool is registered as an MCP tool via the @mcp.tool() decorator on line 513. The decorator registers the function with the FastMCP server instance named 'mcp'.
@mcp.tool() async def get_simdata(simdata_id: str, ctx: Optional[Context] = None) -> Dict[str, Any]: """Retrieves the complete configuration and parameter set for a specific simulation dataset, including region settings, time ranges, and scenario parameters.""" try: if not simdata_id: return format_api_error(400, "simdataId required") async with await get_http_client() as client: api_client = FujitsuSocialDigitalTwinClient(client) result = await api_client.get_simdata(simdata_id) return result except Exception as e: logger.error(f"Simdata retrieval error: {e}") return format_api_error(500, str(e)) - src/fujitsu_sdt_mcp/server.py:47-51 (helper)Helper function 'format_simulation_result' used to wrap successful API responses into a standardized format with success=True.
def format_simulation_result(result: Dict[str, Any]) -> Dict[str, Any]: return { "success": True, "data": result } - src/fujitsu_sdt_mcp/server.py:40-45 (helper)Helper function 'format_api_error' used to wrap error responses into a standardized format with success=False.
def format_api_error(status_code: int, error_detail: str) -> Dict[str, Any]: return { "success": False, "status_code": status_code, "error": error_detail }