Skip to main content
Glama

chat

Sends one message to an agent profile and returns reply, tool calls, trace ID, and session ID; reuse the session ID to continue the conversation.

Instructions

Run ONE chat turn against an agent through the same path the portal's test-chat widget uses: a POST to the profile's endpoint_path with your operator JWT, collected server-side. Returns {reply, tool_calls, trace_id, session_id, latency_ms, errors, served_by, status}. Pass the returned session_id back to continue the conversation.

Which config answers: profile_id ITSELF — a draft copy or a specialist
answers as itself (X-WAJ-Profile-Id, operator-only, same agent_kind as
the endpoint), exactly like the widget. profile_version_id instead pins a
saved snapshot. Each kind's own body is built for you (the AI-agents
demo's `agent` key + case_id); pass back the returned `state` with
session_id to continue a demo conversation.
env = this process's own environment runs in-process; the other env
goes to its default deployment target (deployment_targets).

tool_calls come from the persisted assistant message (name, input,
output — outputs capped at 2000 chars); trace_id is the turn's trace
(open with traces action=overview / transcript). Both can be null if
the agent doesn't persist/trace that turn; the reply is still
returned. This is a REAL turn: it runs the agent's tools and writes
chat history, as the widget does.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "profile_id": "<profile_id>",
      "message": "<message>"
    },
    "name": "chat"
  }
}

Input Schema

NameRequiredDescriptionDefault
envNoConfig branch: which `environment` rows of the AI config DB to read/write. staging = the editable working set (default); prod = what production serves.staging
stateNoAI-agents demo kinds only: the `state` token the previous turn returned — pass it back with session_id to continue (it carries verification/sent status).
localeNoen | ar | tr | ru.en
case_idNoAI-agents demo kinds only: the use case to play (e.g. 'O01'; '' = the agent's first case).
messageYesThe user message for this turn.
profile_idYesProfile to talk to (list_profiles). Its endpoint_path is the route the message is sent to.
session_idNoContinue this conversation ('' = start a new one; the new id is returned).
business_idNoBusiness UUID to chat as (required by agents that read one business's data; '' = none).
timeout_secondsNoGive up after this many seconds (10-300).
profile_version_idNoAnswer with this saved agent_profile_versions snapshot (X-WAJ-Profile-Version, operator-only) instead of profile_id's current config.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: it declares this is a REAL turn that runs the agent's tools and writes chat history, notes operator-only headers, discloses the 2000-char cap on tool-call outputs, and warns that tool_calls and trace_id may be null even when a reply is returned. The side effects and unreliability modes an agent needs before invoking are all stated.

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?

Content is front-loaded with the core action and return shape in the first three lines, then progressively details config selection and caveats. It is dense and parenthetical-heavy, and the return-value sentence partially duplicates the output schema, but almost every statement carries actionable information.

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

Completeness5/5

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

For a 10-parameter tool with a real side-effecting turn, the definition covers everything needed to call it correctly: config selection, env semantics, session continuation, timeout, output caveats, and the fact that history is written. An output schema exists, so the inline return description is surplus rather than a missing piece.

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

Parameters5/5

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

Schema coverage is already 100%, so 3 would be the baseline, but the description adds genuine meaning beyond the schema: profile_id is characterized as 'the profile itself' with the X-WAJ-Profile-Id operator-only header, and profile_version_id is framed as pinning a saved snapshot, which clarifies the intended precedence between two easily confused params. It also explains the session_id/state round-trip and the env branch in terms of which config rows are read or written.

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

Purpose5/5

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

Uses a specific verb and resource ('Run ONE chat turn against an agent') and immediately anchors it to a known equivalent ('the same path the portal's test-chat widget uses'), so an agent knows exactly what this does versus admin siblings like get_profile or eval_runs. The mechanical detail (POST to endpoint_path with the operator JWT) removes ambiguity about what is actually executed.

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

Usage Guidelines4/5

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

Gives explicit routing between modes: profile_id answers as the profile itself, profile_version_id pins a saved snapshot, and env selects in-process vs the default deployment target. It also states how to continue a conversation (pass back session_id, and state for AI-agents demo kinds). It does not name any alternative tool for adjacent tasks (e.g. evals or bakeoffs), which is the only gap.

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