Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/ROOT/pages/8.7.0-release-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ The {productname} {release-version} release includes an accompanying release of

**TinyMCE AI** includes the following improvements and fixes and additions.

==== New `tinymceai_tool_data_callback` option to customize the status message shown while a Model Context Protocol (MCP) tool runs
// #TINYMCE-14474

The **TinyMCE AI** plugin now supports the xref:tinymceai.adoc#tinymceai_tool_data_callback[`+tinymceai_tool_data_callback+`] option. This function runs when an MCP server sends an `+mcp-tool-result+` or `+mcp-tool-notification+` event during a streaming response. The function should return a string that would be displayed as the status message shown in the Chat sidebar while the AI model calls an MCP tool.

==== The custom review textarea showed a scrollbar when it was empty.
// #TINYMCE-14409

Expand Down
49 changes: 49 additions & 0 deletions modules/ROOT/partials/configuration/tinymceai_options.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,55 @@ tinymce.init({
});
----

[[tinymceai_tool_data_callback]]
=== `+tinymceai_tool_data_callback+`

Customizes the status message shown in the Chat sidebar while the AI model calls a Model Context Protocol (MCP) tool. The function runs when the MCP server sends an `+mcp-tool-result+` or `+mcp-tool-notification+` event during a streaming response. The function returns a string to display as the status message, or returns `+undefined+` to fall back to the default status message.

*Type:* `+Function+` (`+(event: MCPToolEvent) => string | undefined+`)

*Default value:* `+undefined+`

The function receives a single `+event+` argument, which is one of the following objects:

* An `+mcp-tool-result+` event, sent when a tool returns a result:
** `+type+`: `+'mcp-tool-result'+`
** `+toolName+` (`+String+`): The name of the tool that ran.
** `+result+` (`+String+`): The result the tool returns.
** `+success+` (`+Boolean+`): Whether the tool call succeeded.
* An `+mcp-tool-notification+` event, sent when a tool reports progress or a log message:
** `+type+`: `+'mcp-tool-notification'+`
** `+toolName+` (`+String+`): The name of the tool that sent the notification.
** `+level+` (`+String+`): The severity of the notification. One of `+'error'+`, `+'info'+`, `+'debug'+`, `+'notice'+`, `+'warning'+`, `+'critical'+`, `+'alert'+`, or `+'emergency'+`.
** `+data+`: The data included with the notification.

A common use is to map each tool name to a human-readable message. For example, the callback can display `+Searching the knowledge base...+` while a `+search-knowledge-base+` tool runs.

.Example
[source,js]
----
tinymce.init({
selector: 'textarea',
plugins: 'tinymceai',
toolbar: 'tinymceai-chat tinymceai-quickactions tinymceai-review',
tinymceai_tool_data_callback: (event) => {
// Map tool names to human-readable status messages
const statusMessages = {
'search-knowledge-base': 'Searching the knowledge base...'
};
if (event.type === 'mcp-tool-result') {
return statusMessages[event.toolName] || `Running ${event.toolName}...`;
}
// Use the default status message for other events
return undefined;
},
// Required for authentication
tinymceai_token_provider: () => {
return fetch('/api/token').then(r => r.json());
}
});
----

[[options-quickactions]]
== Options for Quick Actions

Expand Down
Loading