Skip to content

Discovery Tools

The discovery tools form the first step in any D-Bus interaction. They answer the questions “what services exist?”, “what does this object expose?”, and “what objects does this service own?“.

List well-known D-Bus service names on a bus.

ParameterTypeDefaultDescription
busstringrequired"session" or "system"
include_uniqueboolfalseInclude unique connection names like :1.42

Markdown list with a count header, sorted alphabetically.

## D-Bus session bus — 47 services
- `org.freedesktop.DBus`
- `org.freedesktop.Notifications`
- `org.freedesktop.portal.Desktop`
- `org.kde.KWin`
- `org.mpris.MediaPlayer2.firefox`

When include_unique is true, unique connection names (those starting with :) are included in the list alongside well-known names.

list_services(bus="session")

Introspect a D-Bus object to see its interfaces, methods, properties, and signals. Reports progress from 0 to 4 as it connects, introspects, formats, and completes.

ParameterTypeDefaultDescription
busstringrequired"session" or "system"
servicestringrequiredService name, e.g. "org.freedesktop.Notifications"
object_pathstringrequiredObject path, e.g. "/org/freedesktop/Notifications"
include_standardboolfalseInclude standard D-Bus interfaces (Peer, Introspectable, Properties, ObjectManager)

Markdown document listing each interface with its methods (including in/out argument signatures), properties (with D-Bus type signature and access mode), signals, and child nodes.

## `org.freedesktop.Notifications` at `/org/freedesktop/Notifications`
### Interface: `org.freedesktop.Notifications`
**Methods:**
- `GetCapabilities() -> capabilities: as`
- `Notify(app_name: s, replaces_id: u, app_icon: s, summary: s, body: s, actions: as, hints: a{sv}, expire_timeout: i) -> id: u`
- `CloseNotification(id: u)`
- `GetServerInformation() -> name: s, vendor: s, version: s, spec_version: s`
**Signals:**
- `NotificationClosed(id: u, reason: u)`
- `ActionInvoked(id: u, action_key: s)`

Standard interfaces (org.freedesktop.DBus.Peer, org.freedesktop.DBus.Introspectable, org.freedesktop.DBus.Properties, org.freedesktop.DBus.ObjectManager) are hidden by default. Set include_standard to true to show them.

introspect(
bus="session",
service="org.freedesktop.Notifications",
object_path="/org/freedesktop/Notifications"
)

Recursively walk the D-Bus object tree for a service using breadth-first search, bounded by depth and node count.

ParameterTypeDefaultDescription
busstringrequired"session" or "system"
servicestringrequiredService name
root_pathstring"/"Starting path for the walk
max_depthint20Maximum tree depth to descend

The walk enforces two safety limits:

LimitValueBehavior when hit
MAX_TREE_NODES500Walk stops, output marked as truncated
TOTAL_WALK_TIMEOUT60 secondsWalk stops with a warning logged via context

Progress is reported as (nodes_visited, None) during the walk, so clients that support progress tracking can display a counter.

Sorted list of object paths. Each path shows its non-standard interfaces (standard org.freedesktop.DBus.* interfaces are omitted for clarity). When limits are hit, the header indicates truncation.

## Object tree for `org.freedesktop.systemd1` on system bus — 412 objects
- `/` -- `org.freedesktop.systemd1.Manager`
- `/org/freedesktop/systemd1/job/12345`
- `/org/freedesktop/systemd1/unit/bluetooth_2eservice` -- `org.freedesktop.systemd1.Unit`, `org.freedesktop.systemd1.Service`
- `/org/freedesktop/systemd1/unit/docker_2eservice` -- `org.freedesktop.systemd1.Unit`, `org.freedesktop.systemd1.Service`

When truncated:

## Object tree for `org.bluez` on system bus — 500 objects (truncated at 500)
list_objects(bus="system", service="org.freedesktop.systemd1")

Walk a subtree to narrow results:

list_objects(
bus="system",
service="org.freedesktop.systemd1",
root_path="/org/freedesktop/systemd1/unit",
max_depth=2
)