Skip to main content
Glama

advance_contam_bridge_session

Send control and weather adjustments to a running CONTAM simulation and optionally advance to a new simulation time for airflow and contaminant transport modeling.

Instructions

Use this when you want to send control/weather adjustments to a running bridge session and optionally advance ContamX to a new simulation time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYes
targetTimeSecondsNo
advanceBySecondsNo
requestConcentrationsNo
requestPathFlowsNo
requestTermFlowsNo
requestAhspFlowsNo
requestDuctFlowsNo
requestLeakFlowsNo
requestOutputControlValuesNo
controlNodeAdjustmentsNo
namedControlNodeAdjustmentsNo
zoneConcentrationAdjustmentsNo
namedZoneConcentrationAdjustmentsNo
zoneTemperatureAdjustmentsNo
namedZoneTemperatureAdjustmentsNo
junctionTemperatureAdjustmentsNo
namedJunctionTemperatureAdjustmentsNo
zoneHumidityRatioAdjustmentsNo
namedZoneHumidityRatioAdjustmentsNo
elementAdjustmentsNo
namedElementAdjustmentsNo
ahspFlowAdjustmentsNo
ahsPoaAdjustmentsNo
namedAhsPoaAdjustmentsNo
weatherAdjustmentNo
namedAmbientPressureAdjustmentNo
namedAmbientConcentrationAdjustmentsNo
wpcAdjustmentNo
timeoutSecondsNo

Implementation Reference

  • The "advance_contam_bridge_session" tool is registered here in server.js. It calls `session.advance()` to perform the actual logic of applying adjustments and advancing the simulation.
    server.tool(
      "advance_contam_bridge_session",
      "Use this when you want to send control/weather adjustments to a running bridge session and optionally advance ContamX to a new simulation time.",
      {
        sessionId: z.string(),
        targetTimeSeconds: z.number().int().min(0).optional(),
        advanceBySeconds: z.number().int().min(1).optional(),
        requestConcentrations: z.boolean().optional(),
        requestPathFlows: z.boolean().optional(),
        requestTermFlows: z.boolean().optional(),
        requestAhspFlows: z.boolean().optional(),
        requestDuctFlows: z.boolean().optional(),
        requestLeakFlows: z.boolean().optional(),
        requestOutputControlValues: z.boolean().optional(),
        controlNodeAdjustments: z
          .array(
            z.object({
              nodeId: z.number().int(),
              value: z.number()
            })
          )
          .optional(),
        namedControlNodeAdjustments: z
          .array(
            z.object({
              controlNodeName: z.string(),
              value: z.number()
            })
          )
          .optional(),
        zoneConcentrationAdjustments: z
          .array(
            z.object({
              option: z.union([z.literal(0), z.literal(1)]),
              agentId: z.number().int(),
              zoneIds: z.array(z.number().int()),
              values: z.array(z.number())
            })
          )
          .optional(),
        namedZoneConcentrationAdjustments: z
          .array(
            z.object({
              option: z.union([z.literal(0), z.literal(1)]),
              agentId: z.number().int().optional(),
              agentName: z.string().optional(),
              zoneNames: z.array(z.string()),
              values: z.array(z.number())
            })
          )
          .optional(),
        zoneTemperatureAdjustments: z
          .object({
            zoneIds: z.array(z.number().int()),
            values: z.array(z.number())
          })
          .optional(),
        namedZoneTemperatureAdjustments: z
          .object({
            zoneNames: z.array(z.string()),
            values: z.array(z.number())
          })
          .optional(),
        junctionTemperatureAdjustments: z
          .object({
            junctionIds: z.array(z.number().int()),
            values: z.array(z.number())
          })
          .optional(),
        namedJunctionTemperatureAdjustments: z
          .object({
            junctionNames: z.array(z.string()),
            values: z.array(z.number())
          })
          .optional(),
        zoneHumidityRatioAdjustments: z
          .object({
            zoneIds: z.array(z.number().int()),
            values: z.array(z.number())
          })
          .optional(),
        namedZoneHumidityRatioAdjustments: z
          .object({
            zoneNames: z.array(z.string()),
            values: z.array(z.number())
          })
          .optional(),
        elementAdjustments: z
          .array(
            z.object({
              pathId: z.number().int(),
              elementIndex: z.number().int()
            })
          )
          .optional(),
        namedElementAdjustments: z
          .array(
            z.object({
              pathId: z.number().int().optional(),
              pathSelectorLabel: z.string().optional(),
              fromZoneName: z.string().optional(),
              toZoneName: z.string().optional(),
              elementIndex: z.number().int().optional(),
              elementName: z.string().optional()
            })
          )
          .optional(),
        ahspFlowAdjustments: z
          .object({
            pathIds: z.array(z.number().int()),
            values: z.array(z.number())
          })
          .optional(),
        ahsPoaAdjustments: z
          .object({
            ahsIds: z.array(z.number().int()),
            values: z.array(z.number())
          })
          .optional(),
        namedAhsPoaAdjustments: z
          .object({
            names: z.array(z.string()),
            values: z.array(z.number())
          })
          .optional(),
        weatherAdjustment: z
          .object({
            temperatureK: z.number(),
            pressurePa: z.number(),
            windSpeed: z.number(),
            windDirection: z.number(),
            humidityRatio: z.number().optional()
          })
          .optional(),
        namedAmbientPressureAdjustment: z
          .object({
            timeSeconds: z.number().int().optional(),
            ambientTargetNames: z.array(z.string()),
            values: z.array(z.number()),
            fillValue: z.number().optional()
          })
          .optional(),
        namedAmbientConcentrationAdjustments: z
          .array(
            z.object({
              timeSeconds: z.number().int().optional(),
              agentId: z.number().int().optional(),
              agentName: z.string().optional(),
              ambientTargetNames: z.array(z.string()),
              values: z.array(z.number()),
              fillValue: z.number().optional()
            })
          )
          .optional(),
        wpcAdjustment: z
          .object({
            timeSeconds: z.number().int().optional(),
            agentIds: z.array(z.number().int()).optional(),
            values: z.array(z.number())
          })
          .optional(),
        timeoutSeconds: z.number().int().min(1).max(300).optional()
      },
      async ({
        sessionId,
        targetTimeSeconds,
        advanceBySeconds,
        requestConcentrations,
        requestPathFlows,
        requestTermFlows,
        requestAhspFlows,
        requestDuctFlows,
        requestLeakFlows,
        requestOutputControlValues,
        controlNodeAdjustments,
        namedControlNodeAdjustments,
        zoneConcentrationAdjustments,
        namedZoneConcentrationAdjustments,
        zoneTemperatureAdjustments,
        namedZoneTemperatureAdjustments,
        junctionTemperatureAdjustments,
        namedJunctionTemperatureAdjustments,
        zoneHumidityRatioAdjustments,
        namedZoneHumidityRatioAdjustments,
        elementAdjustments,
        namedElementAdjustments,
        ahspFlowAdjustments,
        ahsPoaAdjustments,
        namedAhsPoaAdjustments,
        weatherAdjustment,
        namedAmbientPressureAdjustment,
        namedAmbientConcentrationAdjustments,
        wpcAdjustment,
        timeoutSeconds
      }) => {
        const session = bridgeSessions.get(sessionId);
        if (!session) {
          throw new Error(`Bridge session not found: ${sessionId}`);
        }
    
        const optionFlags =
          (requestConcentrations ? 2 : 0) +
          (requestPathFlows ? 4 : 0) +
          (requestAhspFlows ? 8 : 0) +
          (requestDuctFlows ? 16 : 0) +
          (requestTermFlows ? 32 : 0) +
          (requestLeakFlows ? 64 : 0) +
          (requestOutputControlValues ? 128 : 0);
    
        let resolvedTargetTime = targetTimeSeconds ?? null;
        if (resolvedTargetTime === null && advanceBySeconds !== undefined) {
          resolvedTargetTime = (session.readyTimeSeconds ?? 0) + advanceBySeconds;
        }
    
        const resolvedControlNodeAdjustments = resolveControlNodeAdjustments(
          session.bridgeMetadata,
          controlNodeAdjustments,
          namedControlNodeAdjustments
        );
        const resolvedZoneConcentrationAdjustments = resolveZoneConcentrationAdjustments(
          session.bridgeMetadata,
          zoneConcentrationAdjustments,
          namedZoneConcentrationAdjustments
        );
        const resolvedZoneTemperatureAdjustments = mergeNamedZoneArrayAdjustment(
          session.bridgeMetadata,
          zoneTemperatureAdjustments,
          namedZoneTemperatureAdjustments
        );
        const resolvedJunctionTemperatureAdjustments = mergeNamedJunctionArrayAdjustment(
          session.bridgeMetadata,
          junctionTemperatureAdjustments,
          namedJunctionTemperatureAdjustments
        );
        const resolvedZoneHumidityRatioAdjustments = mergeNamedZoneArrayAdjustment(
          session.bridgeMetadata,
          zoneHumidityRatioAdjustments,
          namedZoneHumidityRatioAdjustments
        );
        const resolvedElementAdjustments = resolveElementAdjustments(
          session.bridgeMetadata,
          elementAdjustments,
          namedElementAdjustments
        );
        const resolvedAhsPoaAdjustments = mergeNamedIdArrayAdjustment(
          ahsPoaAdjustments,
          namedAhsPoaAdjustments,
          "ahsIds",
          "values",
          (name) =>
            resolveEntityByName(
              session.bridgeMetadata.ahsSystems ?? [],
              name,
              (item) => item.name,
              "AHS",
              (item) => `${item.id}:${item.name}`
            ).id
        );
        if (
          wpcAdjustment &&
          ((namedAmbientConcentrationAdjustments?.length ?? 0) > 0 || namedAmbientPressureAdjustment)
        ) {
          throw new Error(
            "Provide either wpcAdjustment or the named ambient ADJ_WPC helpers, not both."
          );
        }
        if (namedAmbientPressureAdjustment && (namedAmbientConcentrationAdjustments?.length ?? 0) > 0) {
          throw new Error(
            "Provide either namedAmbientPressureAdjustment or namedAmbientConcentrationAdjustments in one call."
          );
        }
        const resolvedWpcAdjustments = wpcAdjustment
          ? [wpcAdjustment]
          : namedAmbientPressureAdjustment
            ? [buildNamedAmbientPressureAdjustment(session.bridgeMetadata, namedAmbientPressureAdjustment)]
            : buildNamedAmbientConcentrationAdjustments(
                session.bridgeMetadata,
                namedAmbientConcentrationAdjustments
              );
    
        if (resolvedTargetTime === null) {
          await session.applyAdjustments({
            controlNodeAdjustments: resolvedControlNodeAdjustments,
            weatherAdjustment,
            zoneConcentrationAdjustments: resolvedZoneConcentrationAdjustments,
            zoneTemperatureAdjustments: resolvedZoneTemperatureAdjustments,
            junctionTemperatureAdjustments: resolvedJunctionTemperatureAdjustments,
            zoneHumidityRatioAdjustments: resolvedZoneHumidityRatioAdjustments,
            elementAdjustments: resolvedElementAdjustments,
            ahspFlowAdjustments,
            ahsPoaAdjustments: resolvedAhsPoaAdjustments,
            wpcAdjustments: resolvedWpcAdjustments
          });
          return toolResponse("Applied bridge adjustments without advancing ContamX.", session.getSummary());
        }
    
        const cycle = await session.advance({
          targetTimeSeconds: resolvedTargetTime,
          optionFlags,
          controlNodeAdjustments: resolvedControlNodeAdjustments,
          weatherAdjustment,
          zoneConcentrationAdjustments: resolvedZoneConcentrationAdjustments,
          zoneTemperatureAdjustments: resolvedZoneTemperatureAdjustments,
          junctionTemperatureAdjustments: resolvedJunctionTemperatureAdjustments,
          zoneHumidityRatioAdjustments: resolvedZoneHumidityRatioAdjustments,
          elementAdjustments: resolvedElementAdjustments,
          ahspFlowAdjustments,
          ahsPoaAdjustments: resolvedAhsPoaAdjustments,
          wpcAdjustments: resolvedWpcAdjustments,
          timeoutSeconds: timeoutSeconds ?? 30
        });
    
        return toolResponse("Advanced the ContamX bridge session.", {
          sessionId,
          targetTimeSeconds: resolvedTargetTime,
          readyTimeSeconds: session.readyTimeSeconds,
          optionFlags,
          updates: cycle.messages.filter((message) => message.type >= bridgeMessageTypes.CONC_UPDATE),
          summary: session.getSummary()
        });
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries full behavioral disclosure burden. It notes the optional nature of advancing time ('optionally advance'), but fails to disclose that the tool also retrieves data (the requestConcentrations/requestPathFlows boolean flags), potential side effects of adjustments, or idempotency characteristics. For a complex 30-parameter mutation tool, this is insufficient.

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, efficient sentence with no redundant words. It front-loads the action ('send control/weather adjustments') and qualifies it appropriately. While arguably too brief for the tool's complexity, it demonstrates good structural efficiency.

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 30 parameters with nested objects, 0% schema coverage, no output schema, and no annotations, the description is radically underspecified. It fails to explain what ContamX is, what data is returned by the request* flags, how the adjustment parameters interact, or prerequisite conditions for the required sessionId parameter.

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

Parameters2/5

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

With 0% schema description coverage across 30 complex parameters, the description attempts to compensate by categorizing parameters as 'control/weather adjustments' and 'advance' parameters. However, it completely omits semantics for the majority of parameters including zone temperature/humidity adjustments, flow requests, element adjustments, and timeout behavior. It provides minimal value beyond the schema structure.

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 sends 'control/weather adjustments' and optionally 'advance[s] ContamX to a new simulation time.' It distinguishes from sibling tools like start_contam_bridge_session by specifying 'running bridge session,' implying this operates on existing sessions rather than creating them. However, it does not explicitly name sibling alternatives or contrasts.

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

Usage Guidelines3/5

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

The description begins with 'Use this when you want to...' providing explicit usage intent, but lacks 'when-not' guidance or explicit mention of prerequisite steps (e.g., requiring start_contam_bridge_session first). The guidance is present but minimal for a tool with 30 parameters.

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/summer521521/contam_MCP'

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