modelcontextprotocol / modelcontextprotocol/ext-apps

ontoolinput is not consistently called

Open
#476 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
2.9k
Forks
387
Avg merge
3h 21m
Merged PRs (30d)
6

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the useApp hook imported from @modelcontextprotocol/ext-apps/react and trace how app.ontoolinput is registered relative to app.connect. Reproduce the manual-prompt tool call in a minimal app and compare it with the working ontoolresult callback. Done means ontoolinput is called for every tool invocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.