Skip to main content

Tools: function calls (custom APIs) and MCP servers

Tools let an agent act during a chat: look up an order, check stock, book a slot, create a ticket. The agent decides when a tool is needed, calls it, and uses the result in its answer.

Plan: LUMA Elevate or Enterprise. Credits: 60 per AI answer (tool calls inside an answer are included).

Function tool call (custom API)​

A custom API tool is one HTTP endpoint of yours that the agent may call.

Set it up in the app​

Agent, then Install & Integrations, then Custom API tool:

SettingDescription
Name and descriptionTell the agent what the tool does and when to use it. The description is what the agent reads, so be precise: "Returns the delivery status of an order. Use it when the customer gives an order number."
Method and URLGET, POST, PUT, PATCH or DELETE, and your HTTPS URL. Use {name} placeholders for values the agent fills in, for example https://api.example.com/orders/{order_id}.
ParametersEach value the agent must collect from the visitor (name, type, required or not, description).
AuthenticationA saved credential (bearer token, API key header, basic), or the visitor's own login passed by your page with AgentWidget.setAuth.
TestRun the tool with sample values before saving.

What your endpoint receives​

  • The method and URL you configured, with the placeholders filled in.
  • Your configured headers and authentication.
  • For POST, PUT and PATCH: a JSON body with the parameters the agent collected.

What your endpoint should return​

  • JSON, with clear field names. The agent reads it and answers in plain language.
  • Keep it small: only what the agent needs to answer.
  • Answer within a few seconds; the visitor is waiting. Return a clear error text (for example {"error":"Order not found"}) instead of an empty answer, so the agent can tell the visitor.

Good practice​

  • Give the tool read-only access where possible; never a credential that can change more than the tool needs.
  • Validate every value on your side; the parameters come from a chat.
  • For actions that change data (payments, cancellations), turn on approval so the visitor confirms in the chat before the call runs.

MCP servers​

An agent can use the tools of a remote Model Context Protocol server.

  • LUMA connects to remote MCP servers over HTTP (Streamable HTTP or SSE URL). Local servers started with a command (npx, uvx, stdio) are not supported.
  • Set it up in the app: agent, then Install & Integrations, then MCP Server: name, URL and headers (for example Authorization: Bearer YOUR_MCP_TOKEN). LUMA lists the server's tools; choose which ones the agent may use.
  • Every tool call goes from LUMA's servers to your MCP server, so the URL must be reachable from the internet.

Manage tools by API​

CallWhat it does
GET /v1/ai-agent/tools/mcp/{projectId}List the MCP servers of the project
POST /v1/ai-agent/tools/mcp / PUT /v1/ai-agent/tools/mcpAdd or change an MCP server
GET /v1/ai-agent/tools/link/{projectId}/{agentId}List the tools linked to an agent
POST /v1/ai-agent/tools/linkLink a tool to an agent
DELETE /v1/ai-agent/tools/link/{projectId}/{agentId}/{linkageId}Unlink a tool
GET /v1/ai-agent/tools/credential/{projectId} / POST /v1/ai-agent/tools/credentialList or save credentials used by tools