- 
                Notifications
    
You must be signed in to change notification settings  - Fork 74
 
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Auto-refetch tools/resources/prompts and update useMcp outputs when notifications/*/list_changed arrive. Make this configurable and callback-enabled. Default behavior: enabled.
API
useMcp({
  autoRefresh: true | {
    tools?: boolean
    resources?: boolean
    prompts?: boolean
  },
  onNotifications?:
    ((n: Notification) => void) | {
      onToolsNotification?: (n: Notification) => void
      onResourcesNotification?: (n: Notification) => void
      onPromptsNotification?: (n: Notification) => void
    }
})Hook return additions:
{
  refreshAll(): Promise<void>
  refreshTools(): Promise<void>
  refreshResources(): Promise<void>
  refreshPrompts(): Promise<void>
}Acceptance Criteria
-  Auto-refetch on tools/resources/prompts 
list_changedand update outputs -  
autoRefreshdefaults totrue, with per-type overrides -  
onNotificationssupports global function or per-type handlers -  New 
refreshAll/refreshTools/refreshResources/refreshPromptsmethods exposed 
Additional Context
This might solve #30, but if you are not partial to changing the hook function signature, perhaps you would consider just making auto refresh be the default ? I cannot think why you would not want auto refresh to be one, since the tool calls and resource requests you make after they have changed might be invalid.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request