Skip to content

ontoolinput is not consistently called #476

@bgonzalez-thestable

Description

@bgonzalez-thestable

Describe the bug
Using the useApp hook, I notice app.ontoolinput is not consistently called although it is registered before app.connect

To Reproduce
Steps to reproduce the behavior:

  1. Instantiate useApp() with a minimal setup:
import { useApp } from "@modelcontextprotocol/ext-apps/react";

//...

useApp({
  appInfo: { name: "Describe your app here...", version: "1.0.0" },
  capabilities: {},
  onAppCreated: (app) => {
    app.ontoolinput = (input) => {
      console.info("Received tool call input:", input);
    };
  },
});
  1. Run the app in any host
  2. Call a tool with user input using a manual prompt
  3. Notice how app.ontoolinput is not always called

Expected behavior
app.ontoolinput is called every time a tool is invoked

Logs
If applicable, add logs to help explain your problem.

Additional context
Other callbacks seem to run as expected, including app.ontoolresult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions