MCPcopy Create free account
hub / github.com/IBM/mcp-cli / SlashCompleter

Class SlashCompleter

src/mcp_cli/interactive/shell.py:32–45  ·  view source on GitHub ↗

Provides completions for slash commands based on registered commands.

Source from the content-addressed store, hash-verified

30
31
32class SlashCompleter(Completer):
33 """Provides completions for slash commands based on registered commands."""
34
35 def __init__(self, command_names: list[str]):
36 self.command_names = command_names
37
38 def get_completions(self, document, complete_event):
39 text = document.text_before_cursor.lstrip()
40 if not text.startswith("/"):
41 return
42 token = text[1:]
43 for name in self.command_names:
44 if name.startswith(token):
45 yield Completion(f"/{name}", start_position=-len(text))
46
47
48async def interactive_mode(

Callers 2

_make_completerMethod · 0.90
interactive_modeFunction · 0.85

Calls

no outgoing calls

Tested by 1

_make_completerMethod · 0.72