Skip to content

Commit 68a5196

Browse files
committed
feat(mbro): add rich tab completion with parameter documentation
- Add intelligent tab completion system showing tool parameters with types, requirements, and descriptions in popup menus - Fix completion cache not populating when using --connect CLI option - Implement Python REPL-style multiline support with '...' continuation prompts for incomplete input - Add parameter value completion with type-aware suggestions (enums, booleans, examples) - Support both param=value and JSON argument styles with smart detection - Add validation for unclosed quotes, brackets, and backslash continuations - Enhance help text to document new completion features The completion system now provides a discoverable, self-documenting interface where users can explore MCP tools and their parameters through tab completion rather than reading documentation. Signed-off-by: Phillip Sitbon <phillip.sitbon@gmail.com>
1 parent ff9b260 commit 68a5196

File tree

5 files changed

+1742
-47
lines changed

5 files changed

+1742
-47
lines changed

docs/mbro.md

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,93 @@ mbro:memory> prompt summarize {"topic": "recent_memories"}
148148

149149
## Advanced Features
150150

151+
### Enhanced Mode Features (New!)
152+
153+
mbro includes advanced features that make it easier and more intuitive to use:
154+
155+
#### 🗣️ Natural Language Commands
156+
Instead of memorizing exact syntax, use natural language:
157+
```bash
158+
# Traditional commands
159+
mbro> tools
160+
mbro> call add {"a": 5, "b": 3}
161+
162+
# Natural language alternatives
163+
mbro> show me all tools
164+
mbro> call add with a=5 and b=3
165+
mbro> what tools are available?
166+
```
167+
168+
#### 📝 Smart Argument Parsing
169+
Multiple ways to specify arguments:
170+
```bash
171+
# JSON format (traditional)
172+
mbro> call weather {"location": "London", "units": "celsius"}
173+
174+
# Key=value format
175+
mbro> call weather location=London units=celsius
176+
177+
# Natural language
178+
mbro> call weather with location as London and units as celsius
179+
```
180+
181+
#### 📄 Multiline JSON Editor
182+
Press `Ctrl+M` to open a multiline JSON editor with:
183+
- Syntax highlighting
184+
- Real-time validation
185+
- Auto-indentation
186+
- Template generation from tool schemas
187+
188+
Example workflow:
189+
```bash
190+
mbro> call complex_tool
191+
This tool requires arguments. Press Ctrl+M to enter them.
192+
mbro> <Ctrl+M>
193+
Enter JSON arguments for 'complex_tool':
194+
Expected properties:
195+
data: object (required) - Complex data structure
196+
options: array - Configuration options
197+
198+
{
199+
"data": {
200+
"key": "value"
201+
},
202+
"options": ["opt1", "opt2"]
203+
}
204+
<Ctrl+D to submit>
205+
```
206+
207+
#### 🔍 Context-Aware Completions
208+
Tab completion now includes:
209+
- Tool names with descriptions
210+
- Connection names with status (active/inactive)
211+
- Parameter suggestions based on tool schemas
212+
- Smart filtering as you type
213+
214+
#### 💡 Intelligent Error Suggestions
215+
When errors occur, get helpful suggestions:
216+
```bash
217+
mbro> call wether {"city": "London"}
218+
Error: Tool 'wether' not found.
219+
Did you mean: weather, whether_tool?
220+
```
221+
222+
#### ⚡ Enhanced Search
223+
- Multi-word search support: `search file manager`
224+
- Searches across names, descriptions, and URIs
225+
- More flexible matching algorithms
226+
227+
### Keyboard Shortcuts
228+
229+
| Shortcut | Action | Context |
230+
|----------|--------|---------|
231+
| `Ctrl+M` | Open multiline JSON editor | Any prompt |
232+
| `Ctrl+R` | Repeat last command | Empty prompt |
233+
| `Ctrl+L` | Clear screen | Any time |
234+
| `Tab` | Autocomplete with descriptions | While typing |
235+
| `↑/↓` | Navigate command history | Any prompt |
236+
| `Ctrl+D` | Exit mbro or submit in multiline | Depends on context |
237+
151238
### Tool Argument Formatting
152239

153240
mbro supports multiple ways to provide tool arguments:
@@ -309,6 +396,37 @@ mbro:magg> call weather_current {"location": "London"}
309396
}
310397
```
311398

399+
### Example 4: Using Natural Language (Enhanced Mode)
400+
401+
```bash
402+
$ mbro
403+
MBRO - MCP Browser
404+
Type 'help' for available commands or 'quit' to exit.
405+
Enhanced mode: Ctrl+M for multiline JSON, natural language supported
406+
407+
mbro> connect to calculator at npx -y @modelcontextprotocol/server-calculator
408+
Connected to 'calculator' (Tools: 4, Resources: 0, Prompts: 0)
409+
410+
mbro:calculator> what tools are available?
411+
Available tools:
412+
- add: Add two numbers
413+
- subtract: Subtract two numbers
414+
- multiply: Multiply two numbers
415+
- divide: Divide two numbers
416+
417+
mbro:calculator> call add with a=25 and b=17
418+
42
419+
420+
mbro:calculator> search for mult
421+
Search results for 'mult':
422+
423+
Tools (1):
424+
- multiply: Multiply two numbers
425+
426+
mbro:calculator> call multiply a=6 b=7
427+
42
428+
```
429+
312430
## Output Modes
313431

314432
mbro supports different output modes for various use cases:
@@ -364,8 +482,9 @@ echo $result | jq '.'
364482

365483
### Command Line Options
366484
- `--connect NAME CONNECTION` - Connect to a server on startup
367-
- `--json` - Output only JSON (machine-readable)
485+
- `--json` - Output only JSON (machine-readable, disables enhanced features)
368486
- `--no-rich` - Disable Rich formatting
487+
- `--no-enhanced` - Disable enhanced features (natural language, multiline, etc.)
369488
- `--indent N` - Set JSON indent level (0 for compact)
370489
- `--repl` - Start in async Python REPL mode instead of command shell
371490
- `--list-connections` - List all available connections

0 commit comments

Comments
 (0)