Skip to main content
Glama
NyxToolsDev

DICOM/HL7/FHIR Interoperability MCP Server

generate_sample_message

Generate realistic HL7 test messages for healthcare integration scenarios like patient admissions, orders, and results to validate system interoperability.

Instructions

[Premium] Generate realistic sample HL7 messages for testing. Supports ADT^A01, ADT^A04, ADT^A08, ADT^A03, ADT^A34, ADT^A40, ORM^O01, ORU^R01, MDM^T02, SIU^S12, DFT^P03.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_typeYesHL7 message type (e.g., 'ADT^A01', 'ORM^O01', 'ORU^R01').
scenarioNoOptional scenario description (e.g., 'emergency CT', 'routine MRI', 'outpatient X-ray').

Implementation Reference

  • The actual implementation of the generate_sample_message tool.
    def generate_sample_message(message_type: str, scenario: str = "") -> str:
        """Generate sample HL7 messages for testing.
    
        Args:
            message_type: HL7 message type (e.g., "ADT^A01", "ORM^O01", "ORU^R01",
                "ADT^A08", "ADT^A34", "MDM^T02", "SIU^S12", "DFT^P03").
            scenario: Optional description of the scenario (e.g., "emergency CT",
                "routine MRI", "outpatient X-ray").
    
        Returns:
            Realistic sample HL7 message with meaningful test data.
        """
        premium_check = require_premium("generate_sample_message")
        if premium_check:
            return premium_check
    
        msg_type = message_type.strip().upper().replace(" ", "")
        if "^" not in msg_type:
            return f"Invalid message type '{msg_type}'. Expected format: TYPE^TRIGGER (e.g., 'ADT^A01')."
    
        now = datetime.now()
        timestamp = now.strftime("%Y%m%d%H%M%S")
        msg_ctrl_id = f"MSG{now.strftime('%Y%m%d%H%M%S%f')[:18]}"
        scenario_lower = scenario.lower()
    
        generators = {
            "ADT^A01": _gen_adt_a01,
            "ADT^A04": _gen_adt_a04,
            "ADT^A08": _gen_adt_a08,
  • Registration of the generate_sample_message tool within the MCP server definition.
    Tool(
        name="generate_sample_message",
        description=(
            "[Premium] Generate realistic sample HL7 messages for testing. "
            "Supports ADT^A01, ADT^A04, ADT^A08, ADT^A03, ADT^A34, ADT^A40, "
            "ORM^O01, ORU^R01, MDM^T02, SIU^S12, DFT^P03."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "message_type": {
                    "type": "string",
                    "description": "HL7 message type (e.g., 'ADT^A01', 'ORM^O01', 'ORU^R01').",
                },
                "scenario": {
                    "type": "string",
                    "description": "Optional scenario description (e.g., 'emergency CT', 'routine MRI', 'outpatient X-ray').",
                    "default": "",
                },
            },
            "required": ["message_type"],

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/NyxToolsDev/dicom-hl7-mcp-server'

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