AddPrompt adds a [Prompt] to the server, or replaces one with the same name.
(p *Prompt, h PromptHandler)
| 200 | |
| 201 | // AddPrompt adds a [Prompt] to the server, or replaces one with the same name. |
| 202 | func (s *Server) AddPrompt(p *Prompt, h PromptHandler) { |
| 203 | // Assume there was a change, since add replaces existing items. |
| 204 | // (It's possible an item was replaced with an identical one, but not worth checking.) |
| 205 | s.changeAndNotify( |
| 206 | notificationPromptListChanged, |
| 207 | func() bool { s.prompts.add(&serverPrompt{p, h}); return true }) |
| 208 | } |
| 209 | |
| 210 | // RemovePrompts removes the prompts with the given names. |
| 211 | // It is not an error to remove a nonexistent prompt. |