Assemble Endpoint

Overview

The assemble endpoint is used to synthesize agent specifications based on context, location, role, and other parameters. It requires either role_id or role_name (not both), and assembles the appropriate character, MCPs, and agents based on the specified collection type.

The endpoint supports three collection types:

  • collection: Assemble from existing collections by providing collection IDs
  • zone: Assemble from existing zones by providing zone IDs
  • manual: Manually specify the character, assets, MCPs, and agents to include

The response includes a complete agent specification with character configuration, MCPs with applied masks and focus fields, agents with applied masks, a digital signature for verification, and a compact tree context (mim_graph) showing the relationships between collections/assets and their directly attached MCPs and agents.

POST/assemble

Assemble Role

Assemble a role with specified collections, zones, or manual configurations. Requires either role_id or role_name (not both). The full role information is included in the assembly log.

Request Parameters

NameTypeRequiredDescription
role_idstringConditional*Role ID to be assembled. Either role_id or role_name is required (not both).
role_namestringConditional*Role name to be assembled. Uses role-name-index. Either role_id or role_name is required (not both).
collection_typestringYesCollection type: "collection", "zone", or "manual"
ids_to_assemblearray[string]Conditional**List of collection IDs or zone IDs (required for collection or zone type)
lists_to_assembleobjectConditional**Dictionary containing manual assembly lists (required for manual type). Contains character_id, asset_list, mcp_list, and agent_list.

* Either role_id or role_name is required, but not both.
** Required based on collection_type: ids_to_assemble for "collection" or "zone", lists_to_assemble for "manual".

Example Requests

{
  "role_id": "ecd12392-d3f8-497b-90bf-f8fe658c6854",
  "collection_type": "collection",
  "ids_to_assemble": [
    "0b7fefdf-3e1f-4c5a-adc6-75b7ff6081df"
  ]
}

Example Response

{
  "assembly_id": "4680463d-2392-423f-aa1e-9d857ac4b528",
  "assembled_at": 1763585970.4975367,
  "character": {
    "welcome_prompt": "Provide a short, concise introduction no more than two sentences.",
    "created_at": 1763425908.2650073,
    "custom_inference_uri": "",
    "config": {
      "model": "gpt-5.1-2025-11-13"
    },
    "customer_id": "org_35c8wKSu13o7YjG0gCdWNaC4COy",
    "auth_type": "API-key",
    "name": "John",
    "updated_at": 1763425908.2650132,
    "pre_tool_prompt": "You are John, a kind, soft-spoken AI assistant helping nurses interact with digital systems at the bedside or nurse station. Your tone is supportive, unhurried, and reassuring. You understand the nurse’s workflow and aim to reduce their mental load.",
    "inference_endpoint": "OpenAI",
    "post_tool_prompt": "Assist with charting, data entry, medication reminders, and equipment status queries. Keep responses concise and confirm details verbally before submitting or logging any data. Provide backup prompts for quick actions (“Would you like me to record this vital now?”). Default to politeness, deference, and clarity. Maintain an even tone under stress and always prioritize patient well-being and documentation accuracy.",
    "description": "A soft spoken persona to help nurses navigate high workloads in the clinic.",
    "auth_uri": "",
    "character_id": "d26211d2-99fa-4e38-b59b-0d886b9f04a1"
  },
  "mcps": [
    {
      "mcp_id": "5579e79a-b895-45fb-afb2-7d37041a40bd",
      "name": "Vitals Monitors",
      "description": "Interface to all of the mobile vitals monitoring stations in the Oasis Clinic facility.",
      "mcp_type": "streamableHTTP",
      "mcp_uri": "http://192.168.1.1:3006",
      "auth_type": "OAuth",
      "auth_uri": "https://auth.mimory.io",
      "tool_permission_map": {
        "mon_get_vitals": [
          "{resource}_read"
        ],
        "mon_set_alert_level": [
          "nurse_alert_set"
        ],
        "mon_clear_alert_level": [
          "nurse_alert_delete"
        ],
        "mon_get_alert_levels": [
          "nurse_alert_read"
        ]
      },
      "guidelet": "When using get_vitals, make sure to pass the vital vector of interest.",
      "focus": {
        "mon_get_vitals": {
          "vital": [
            "heart_rate"
          ]
        },
        "mon_set_alert_level": {
          "vital": [
            "heart_rate"
          ]
        },
        "mon_get_alert_levels": {
          "vital": [
            "heart_rate"
          ]
        },
        "mon_clear_alert_level": {
          "vital": [
            "heart_rate"
          ]
        }
      },
      "scope_map": {
        "mon_get_vitals": [
          "mon_1345-ba-246"
        ],
        "mon_set_alert_level": [
          "mon_1345-ba-246"
        ],
        "mon_get_alert_levels": [
          "mon_1345-ba-246"
        ],
        "mon_clear_alert_level": [
          "mon_1345-ba-246"
        ]
      },
      "created_at": 1763427649.6782727,
      "updated_at": 1763432668.4701214
    },
    {
      "mcp_id": "4b6262df-f1f0-4d51-a36b-1eab3b55cc1b",
      "name": "EHR2",
      "description": "EHR and MCP offered by the IHC.",
      "mcp_type": "streamableHTTP",
      "mcp_uri": "http://192.168.1.1:3002",
      "auth_type": "OAuth",
      "auth_uri": "https://auth.mimory.io",
      "tool_permission_map": {
        "ihc_update_patient_medication": [
          "{resource}_read",
          "{resource}_write"
        ],
        "ihc_get_patient_history": [
          "{resource}_read"
        ],
        "ihc_get_patient_immunizations": [
          "{resource}_read"
        ],
        "ihc_update_patient_vitals": [
          "{resource}_read",
          "{resource}_write"
        ],
        "ihc_get_patient_conditions": [
          "{resource}_read"
        ],
        "ihc_get_patient_procedures": [
          "{resource}_read"
        ],
        "ihc_get_patient_info": [
          "{resource}_read"
        ],
        "ihc_get_patient_medications": [
          "{resource}_read"
        ],
        "ihc_get_patient_allergies": [
          "{resource}_read"
        ]
      },
      "guidelet": "Always use ihc_get_patient_info first to get an overview of the patient.\n\nWhen prescribing a medication, check allergies and current medications.",
      "focus": {
        "ihc_get_patient_info": {
          "patient_id": [
            "P003",
            "P002"
          ]
        },
        "ihc_get_patient_history": {
          "patient_id": [
            "P003",
            "P002"
          ]
        },
        "ihc_get_patient_allergies": {
          "patient_id": [
            "P003",
            "P002"
          ]
        },
        "ihc_get_patient_conditions": {
          "patient_id": [
            "P003",
            "P002"
          ]
        }
      },
      "scope_map": {
        "ihc_get_patient_info": [
          "P003",
          "P002"
        ],
        "ihc_get_patient_history": [
          "P003",
          "P002"
        ],
        "ihc_get_patient_allergies": [
          "P003",
          "P002"
        ],
        "ihc_get_patient_conditions": [
          "P003",
          "P002"
        ]
      },
      "created_at": 1763426221.3336644,
      "updated_at": 1763432514.1342554
    },
    {
      "mcp_id": "e5daaf65-99a9-4c45-b73d-f625863a8d6b",
      "name": "EHR1",
      "description": "EHR and associated MCP offered by the ACME company.",
      "mcp_type": "streamableHTTP",
      "mcp_uri": "http://192.168.1.1:3000",
      "auth_type": "OAuth",
      "auth_uri": "https://auth.mimory.io",
      "tool_permission_map": {
        "acme_get_patient_procedures": [
          "{resource}_read"
        ],
        "acme_update_patient_medication": [
          "{resource}_read",
          "{resource}_write"
        ],
        "acme_get_patient_conditions": [
          "{resource}_read"
        ],
        "acme_get_patient_allergies": [
          "{resource}_read"
        ],
        "acme_update_patient_vitals": [
          "{resource}_read",
          "{resource}_write"
        ],
        "acme_get_patient_medications": [
          "{resource}_read"
        ],
        "acme_get_patient_history": [
          "{resource}_read"
        ],
        "acme_get_patient_immunizations": [
          "{resource}_read"
        ],
        "acme_list_patients": [
          "admin_read"
        ],
        "acme_get_patient_info": [
          "{resource}_read"
        ]
      },
      "guidelet": "Always use acme_get_patient_info first to get an overview of the patient.\n\nWhen prescribing a medication, check allergies and current medications.",
      "focus": {
        "acme_get_patient_info": {
          "patient_id": [
            "P001"
          ]
        },
        "acme_get_patient_history": {
          "patient_id": [
            "P001"
          ]
        },
        "acme_get_patient_medications": {
          "patient_id": [
            "P001"
          ]
        },
        "acme_get_patient_procedures": {
          "patient_id": [
            "P001"
          ]
        },
        "acme_get_patient_allergies": {
          "patient_id": [
            "P001"
          ]
        },
        "acme_get_patient_immunizations": {
          "patient_id": [
            "P001"
          ]
        },
        "acme_get_patient_conditions": {
          "patient_id": [
            "P001"
          ]
        },
        "acme_update_patient_vitals": {
          "patient_id": [
            "P001"
          ]
        }
      },
      "scope_map": {
        "acme_get_patient_info": [
          "P001"
        ],
        "acme_get_patient_history": [
          "P001"
        ],
        "acme_get_patient_medications": [
          "P001"
        ],
        "acme_get_patient_procedures": [
          "P001"
        ],
        "acme_get_patient_allergies": [
          "P001"
        ],
        "acme_get_patient_immunizations": [
          "P001"
        ],
        "acme_get_patient_conditions": [
          "P001"
        ],
        "acme_update_patient_vitals": [
          "P001"
        ]
      },
      "created_at": 1763426173.2370903,
      "updated_at": 1763432504.7125866
    },
    {
      "mcp_id": "e6ffbf94-d447-45a7-9f45-924ae3a64a58",
      "name": "Ring Health",
      "description": "A ring based health monitor from the Ring company.",
      "mcp_type": "streamableHTTP",
      "mcp_uri": "https://192.168.1.1:3004",
      "auth_type": "OAuth",
      "auth_uri": "https://auth.mimory.io",
      "tool_permission_map": {
        "ring_get_sleep_telemetry": [
          "{resource}_read"
        ],
        "ring_get_ppg_records": [
          "{resource}_read"
        ],
        "ring_list_users": [
          "admin_read"
        ],
        "ring_get_recorded_exercises": [
          "{resource}_read"
        ],
        "ring_get_user_summary": [
          "{resource}_read"
        ]
      },
      "guidelet": "Exercises are categorized into major buckets such as aerobic, anaerobic, and HIIT.\n\nSleep telemetry is split into 15 minute segments and is given a score between 1 and 10.",
      "focus": {
        "ring_get_ppg_records": {
          "user_id": [
            "U100"
          ]
        },
        "ring_get_sleep_telemetry": {
          "user_id": [
            "U100"
          ]
        },
        "ring_get_recorded_exercises": {
          "user_id": [
            "U100"
          ]
        },
        "ring_get_user_summary": {
          "user_id": [
            "U100"
          ]
        }
      },
      "scope_map": {
        "ring_get_ppg_records": [
          "U100"
        ],
        "ring_get_sleep_telemetry": [
          "U100"
        ],
        "ring_get_recorded_exercises": [
          "U100"
        ],
        "ring_get_user_summary": [
          "U100"
        ]
      },
      "created_at": 1763426288.783984,
      "updated_at": 1763432585.070746
    }
  ],
  "agents": [
    {
      "agent_id": "788f8d31-7c4f-4d24-ac48-206f1ce7ba2f",
      "name": "Insurance Checker",
      "description": "Check whether an insurance covers a specific procedure.",
      "init_parameters": {},
      "scope_map": [],
      "agent_uri": "http://192.168.1.1:8001",
      "auth_type": "OAuth",
      "auth_uri": "https://auth.mimory.io",
      "agent_permission_map": [],
      "guidelet": "When checking, provide justification along with the code being checked.",
      "created_at": 1763426576.9772809,
      "updated_at": 1763432396.1474092
    }
  ],
  "mim_graph": {
    "N": [
      {
        "node_name": "Vitals Station 2",
        "mcps": [
          {
            "mcp_name": "Vitals Monitors",
            "parameter_overrides": {
              "vital": [
                "heart_rate"
              ]
            },
            "tools": [
              "mon_get_vitals",
              "mon_set_alert_level",
              "mon_get_alert_levels",
              "mon_clear_alert_level"
            ],
            "resource_scope_fragments": [
              "mon_1345-ba-246"
            ]
          }
        ],
        "agents": []
      },
      {
        "node_name": "P002",
        "mcps": [
          {
            "mcp_name": "EHR2",
            "parameter_overrides": {
              "patient_id": [
                "P002"
              ]
            },
            "tools": [
              "ihc_get_patient_info",
              "ihc_get_patient_history",
              "ihc_get_patient_allergies",
              "ihc_get_patient_conditions"
            ],
            "resource_scope_fragments": [
              "P002"
            ]
          }
        ],
        "agents": []
      },
      {
        "node_name": "P003",
        "mcps": [
          {
            "mcp_name": "EHR2",
            "parameter_overrides": {
              "patient_id": [
                "P003"
              ]
            },
            "tools": [
              "ihc_get_patient_info",
              "ihc_get_patient_history",
              "ihc_get_patient_allergies",
              "ihc_get_patient_conditions"
            ],
            "resource_scope_fragments": [
              "P003"
            ]
          }
        ],
        "agents": [
          {
            "agent_name": "Insurance Checker",
            "parameter_overrides": {},
            "resource_scope_fragments": []
          }
        ]
      },
      {
        "node_name": "P001",
        "mcps": [
          {
            "mcp_name": "EHR1",
            "parameter_overrides": {
              "patient_id": [
                "P001"
              ]
            },
            "tools": [
              "acme_get_patient_info",
              "acme_get_patient_history",
              "acme_get_patient_medications",
              "acme_get_patient_procedures",
              "acme_get_patient_allergies",
              "acme_get_patient_immunizations",
              "acme_get_patient_conditions",
              "acme_update_patient_vitals"
            ],
            "resource_scope_fragments": [
              "P001"
            ]
          },
          {
            "mcp_name": "Ring Health",
            "parameter_overrides": {
              "user_id": [
                "U100"
              ]
            },
            "tools": [
              "ring_get_ppg_records",
              "ring_get_sleep_telemetry",
              "ring_get_recorded_exercises",
              "ring_get_user_summary"
            ],
            "resource_scope_fragments": [
              "U100"
            ]
          }
        ],
        "agents": [
          {
            "agent_name": "Insurance Checker",
            "parameter_overrides": {},
            "resource_scope_fragments": []
          }
        ]
      },
      {
        "node_name": "Oasis Clinic Room 1",
        "mcps": [],
        "agents": []
      }
    ],
    "E": [
      [
        "Basic",
        "Oasis Clinic Room 1",
        "Vitals Station 2"
      ],
      [
        "Patient",
        "Oasis Clinic Room 1",
        "P001"
      ],
      [
        "Sibling",
        "P001",
        "P003"
      ],
      [
        "Sibling",
        "P003",
        "P002"
      ]
    ]
  },
  "signature": {
    "algorithm": "RSA-PSS-SHA256",
    "signature": "L9Uur2TYptIRbauqN6QrU9+E4c17K9io+N4pPQxXK6s6c+J2X2EkfmvC8aMT+8H0kDgAk32eGhpkM282z/pMc7Uizqij1UXnTVKp+OQqZq1zyH7HQhcgEteMxAA0qZSmzTdVZ26usL2aMHqb7eHCfxMLf84Z4WVmSbJoeFgEhmQaA6rWSxOVh59YzrwwWi5fiyVZ8ppL0T+wNb33Gx73EEsT7n6VwoQpWIYBDhFrNqWOeicwtcFrODsqsNz2UxF8vtQWXSRF7VE5A+oPoCqZHQcYdnxpVMYKFEmKIqDus/1Vjv/YF00P32C+Rez8io/XEP05bvWA04/17NRyuge0EA==",
    "timestamp": "1763585970.4975367",
    "kid": "c2b54b5f-ec6e-419e-ac2b-a24bbc64e816"
  }
}

Response Fields

assembly_id

Unique identifier for this assembly operation.

assembled_at

ISO 8601 timestamp of when the assembly was created.

character

Character configuration associated with the role and collection/zone.

mcps

Array of MCP configurations with mask applied, narrowed to single role, and including focus field and scope_map.

agents

Array of agent configurations with mask applied, narrowed to single role, and including scope_map.

signature

Digital signature for verifying the integrity and authenticity of the assembly response. Includes algorithm, signature, timestamp, and key ID (kid).

mim_graph

Compact tree context showing relationships between collections/assets and their directly attached MCPs and agents.

Contains:

  • N: Array of nodes (collections or assets) with their directly attached MCPs and agents
  • E: Array of edges represented as [binding_rule_name, source_node_name, destination_node_name]

Note: This endpoint requires authentication via the x-api-key header. Common error responses include 400 (Bad Request - Invalid parameter format or missing required fields), 401 (Unauthorized), 404 (Not Found - Role, collection, or zone not found), and 500 (Internal Server Error).