Skip to main content
Glama

Let the site's chat call a function

set_function_chat_action
Idempotent

Open one of the site's functions to its chatbot ("call my API"): when a visitor asks something the function answers, the chat asks for the inputs listed here, calls the function with only those, and tells the visitor its reply. Example: a repair shop's "check my repair status" by job number. The function receives POST { "source": "chat", "inputs": { ... } } and should answer JSON { "reply": "one sentence for the visitor", "buttons": [...], "image": "https://..." }: buttons (optional, up to 3) are { "label", "url" } to open an https link or { "label", "reply" } to send that text as the visitor's next message, labels at most 20 characters; image (optional) is one https picture shown with the reply. Anything else in a button is dropped. The website chat and WhatsApp both show them. verified_customer_only keeps it for visitors who proved who they are first. read_only: true says it only looks things up and changes nothing, so a test chat (Test & improve) calls it for real; other functions are shown there as "would call" and never run. Pass close: true to stop the chat calling it. It affects what visitors are told as soon as the function is deployed.

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": {
      "site_id": "<site_id>",
      "function": "<function>"
    },
    "name": "set_function_chat_action"
  }
}

Input Schema

NameRequiredDescriptionDefault
whenNoWhen the chat should call it, in the owner's words: "a customer asks how their repair is going"
closeNotrue: the chat no longer calls this function
labelNoWhat it is called for the owner, e.g. "Check repair status"
inputsNo
site_idYesThe site, from list_sites
functionYesThe function's name (slug), display name or id, from list_functions
read_onlyNo
user_goalNoOptional: the user's goal behind this call, in one short sentence of plain words (e.g. "add a page so customers can book tables"). No names, emails or other personal details.
verified_customer_onlyNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / read_only
      Added value: +{
      +  "type": "boolean"
      +}
  2. Added

TDQS

A4.1/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=false, idempotentHint=true, destructiveHint=false), the description discloses the exact request contract (POST with source/inputs), the expected JSON reply shape, button limits (max 3, labels ≤20 chars, https URLs), that unknown button fields are dropped, and that both web chat and WhatsApp render them. It also explains that read_only=true makes Test & improve call the function for real while other functions show as "would call", and warns the change takes effect as soon as the function is deployed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded with a good example, but the body is a dense run-on of clauses, parentheses, and mid-sentence backticks that mixes the request contract, response contract, and flag semantics without paragraph breaks. Nearly every clause carries information, but the packing hurts scanability.

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

Completeness4/5

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

For a 9-parameter, no-output-schema configuration tool, the description covers the essential contract: what the chatbot sends, what the function must return, how optional buttons/image behave, and what the safety flags mean. Remaining gaps (validation errors, what happens if the function is missing, deployment prerequisites) are secondary.

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

Parameters4/5

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

Schema coverage is 67%, and the description carries the two booleans with no schema description: read_only (lookup-only, so the test chat executes it for real) and verified_customer_only (only visitors who proved identity). It also explains close=true and that the declared inputs are what the chat asks for, though it leaves when, label, and user_goal to their already-clear schema descriptions.

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 first sentence gives a specific verb and resource: open one of the site's functions to its chatbot, with a concrete repair-status example. It is clearly distinct in effect from siblings like create_function_draft or deploy_function, though it never names an alternative to contrast against.

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?

The description supplies clear context for use (a visitor asks something the function answers) and an explicit off-switch ("Pass `close: true` to stop the chat calling it"). It does not state exclusions or point to related configuration tools such as set_chat_decision_mode or test_function, so it stops short of full routing guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources