refactor: rename request methods to remove send prefix (#161)
* refactor: rename request methods to remove send prefix Following the MCP TS SDK convention where request methods don't have the "send" prefix (reserved for notifications): - App.sendMessage() → App.message() - App.sendOpenLink() → App.openLink() - AppBridge.sendResourceTeardown() → AppBridge.resourceTeardown() The old method names are kept as deprecated aliases for backwards compatibility. Updated all examples to use the new method names. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * test: add tests for deprecated method aliases - Update existing tests to use new method names (message, openLink) - Add tests verifying deprecated aliases are same reference as new methods - Add tests verifying deprecated aliases still work functionally 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: rename message→sendMessage, resourceTeardown→teardownResource - App.message() → App.sendMessage() (with deprecated message alias) - AppBridge.resourceTeardown() → AppBridge.teardownResource() (with deprecated aliases) This better follows the pattern where methods that send data have 'send' or action verb prefix. * fix: update examples to use sendMessage instead of message * fix: update basic-host to use teardownResource * fix: update threejs-server to use sendMessage * refactor: remove deprecated app.message alias The app.message alias was removed since sendMessage is the correct name. sendResourceTeardown already exists in AppBridge. * refactor: remove resourceTeardown alias, keep only sendResourceTeardown --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
37aab03de0
commit
2dd223b611
1 changed files with 59 additions and 259 deletions
|
|
@ -32,7 +32,7 @@ export interface WidgetProps<TToolInput = Record<string, unknown>> {
|
|||
/** Send a message to the host's chat */
|
||||
sendMessage: App["sendMessage"];
|
||||
/** Request the host to open a URL */
|
||||
sendOpenLink: App["sendOpenLink"];
|
||||
openLink: App["openLink"];
|
||||
/** Send log messages to the host */
|
||||
sendLog: App["sendLog"];
|
||||
}
|
||||
|
|
@ -81,8 +81,8 @@ function McpAppWrapper() {
|
|||
(params, options) => app!.sendMessage(params, options),
|
||||
[app],
|
||||
);
|
||||
const sendOpenLink = useCallback<App["sendOpenLink"]>(
|
||||
(params, options) => app!.sendOpenLink(params, options),
|
||||
const openLink = useCallback<App["openLink"]>(
|
||||
(params, options) => app!.openLink(params, options),
|
||||
[app],
|
||||
);
|
||||
const sendLog = useCallback<App["sendLog"]>(
|
||||
|
|
@ -106,7 +106,7 @@ function McpAppWrapper() {
|
|||
hostContext={hostContext}
|
||||
callServerTool={callServerTool}
|
||||
sendMessage={sendMessage}
|
||||
sendOpenLink={sendOpenLink}
|
||||
openLink={openLink}
|
||||
sendLog={sendLog}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue