Skip to content
WebMCP Agents
Esc
↑↓navigate↵open⌘Jpreview
On this page

defineChatMessages

A message-catalog override, typed where it is written: the identity function, for autocomplete and a type check.

Returns the overrides it is given, typed as a ChatMessagesInput (a partial ChatMessages at any depth). Use it where you write the chat’s words outside the JSX, so the editor completes the keys and a function’s values are typed.

Import

import { defineChatMessages } from "@webmcp-agents/chat";

Example

export const messages = defineChatMessages({
  title: "Field Store assistant",
  composer: { placeholder: "Ask about an order" },
  tool: { running: ({ tool }) => `Working on ${tool}…` },
  errors: { rate_limited: "Too many messages. Give it a minute." },
});

Options

defineChatMessages(messages).

Name Type Default Description
messages ChatMessagesInput required Any part of the catalog. Missing keys stay English.

Returns

messages, unchanged, with its literal type.

See also

Was this page helpful?