MCPcopy Create free account
hub / github.com/AI45Lab/Code / list_commands

Method list_commands

sdk/python/src/lib.rs:3243–3256  ·  view source on GitHub ↗

List all registered slash commands. Returns a list of dicts with keys: `name`, `description`, `usage` (or `None`). Slash commands can be invoked via `session.send("/command args")`.

(&self, py: Python<'py>)

Source from the content-addressed store, hash-verified

3241 /// Returns a list of dicts with keys: `name`, `description`, `usage` (or `None`).
3242 /// Slash commands can be invoked via `session.send("/command args")`.
3243 fn list_commands<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyList>> {
3244 let commands = self.inner.command_registry().list_full();
3245 let items: Vec<_> = commands
3246 .into_iter()
3247 .map(|(name, description, usage)| {
3248 let d = PyDict::new(py);
3249 let _ = d.set_item("name", &name);
3250 let _ = d.set_item("description", &description);
3251 let _ = d.set_item("usage", usage.as_deref());
3252 d.into_any()
3253 })
3254 .collect();
3255 PyList::new(py, &items)
3256 }
3257
3258 /// Register a custom slash command with a Python callback.
3259 ///

Callers

nothing calls this directly

Calls 2

list_fullMethod · 0.80
command_registryMethod · 0.80

Tested by

no test coverage detected