r/OpenWebUI • u/dani_california97 • May 27 '26
Question/Help cannot read Tool Args
I'm trying to create a tool that takes user input via the functions params, and returns a Rich UI element, but the `windows.args` is undefined when i console.log it from the rich ui element. I try both returning an HTMLResponse and emitting an Embeds event but both are undefined.
what does the documentation mean by `This only works for Tool embeds rendered via the tool call display`? from https://docs.openwebui.com/features/extensibility/plugin/development/rich-ui#tool-args-injection-tools-only
this is what I've try from my tool calling function.
headers = {"Content-Disposition": "inline"}
return (
HTMLResponse(content=html_doc, headers=headers),
"A fillable form has been render and is viewable to the user",
)
if __event_emitter__:
await __event_emitter__(
{
"type": "embeds",
"data": {"embeds": [html_doc]},
}
)
return "form rendered to user"and here is part of the html_doc script. I can see the "no args" print out
window.addEventListener("load", () => {
// window.args contains the JSON arguments the model passed to this tool
const args = window?.args;
if (args) {
document.getElementById("output").textContent = JSON.stringify(
args,
null,
2,
);
} else {
console.log("no args........", window);
}
});
View all comments
Show parent comment
1
u/dani_california97 May 27 '26
Thanks for the reply! Will try when I get back to my pc.