I have the following code for a button click on my widget:
const helloAgain = async () => {
await window.openai.callTool("test-tool", { "title_text": "hi again. :)" });
};
And in the MCP server I’m using this:
widgets: List[TestWidget] = [
TestWidget(
identifier="test-tool",
title="Show Test",
template_uri="ui://widget/test.html",
invoking="Displaying test",
invoked="Rendered test",
Yet the component doesn’t seem to be respond with any changes then the button is clicked and the callTool is executed.
I see this mentioned in the docs “Please note that your tool needs to be marked as able to be initiated by the component.”
This is mentioned on this developers doc page:
/apps-sdk/build/custom-ux
But I don’t see where there is any description of how to have the tool marked this way.
If it is “openai/widgetAccessible”: True,… then I have this set but it doesn’t seem to be helping.
def _tool_meta(widget: TestWidget) -> Dict[str, Any]:
return {
"openai/outputTemplate": widget.template_uri,
"openai/toolInvocation/invoking": widget.invoking,
"openai/toolInvocation/invoked": widget.invoked,
"openai/widgetAccessible": True,
"openai/resultCanProduceWidget": True,
"annotations": {
"destructiveHint": False,
"openWorldHint": False,
"readOnlyHint": True,
}
}