Skip to content

Interaction Tools

The interaction tools operate on specific D-Bus objects once you know their service name, object path, and interface. Use the discovery tools to find those coordinates first.

Call a D-Bus method and return the result.

ParameterTypeDefaultDescription
busstringrequired"session" or "system"
servicestringrequiredService name, e.g. "org.freedesktop.Notifications"
object_pathstringrequiredObject path, e.g. "/org/freedesktop/Notifications"
interfacestringrequiredInterface name, e.g. "org.freedesktop.Notifications"
methodstringrequiredMethod name, e.g. "Notify"
argsstring"[]"JSON array of arguments
signaturestring""D-Bus type signature string; leave empty for no-arg methods

System bus calls require user confirmation before execution. Session bus calls proceed without prompting (they operate within user scope). See Confirmation Flow for details on how confirmation is resolved.

The args parameter accepts a JSON array string. Each element is deserialized according to the corresponding type in the signature string.

For Variant (v) signatures, two modes are supported:

Simple Python types are automatically wrapped into D-Bus Variants:

Python typeInferred signature
bool"b"
str"s"
int"i"
float"d"
list"as" (array of strings)
dict"a{sv}" (dict of string to variant)
["hello", true, 42]
  • Single-element responses are unwrapped from their containing array for cleaner output
  • Multi-element responses are returned as a JSON array
  • Void methods return the string "Method returned no data (void)."
  • All values are JSON-formatted with 2-space indentation

Send a desktop notification:

call_method(
bus="session",
service="org.freedesktop.Notifications",
object_path="/org/freedesktop/Notifications",
interface="org.freedesktop.Notifications",
method="Notify",
args='["mcdbus", 0, "", "Hello", "World", [], {}, 5000]',
signature="susssasa{sv}i"
)

Call a no-arg method:

call_method(
bus="session",
service="org.freedesktop.Notifications",
object_path="/org/freedesktop/Notifications",
interface="org.freedesktop.Notifications",
method="GetServerInformation"
)

Read a single D-Bus property value.

ParameterTypeDefaultDescription
busstringrequired"session" or "system"
servicestringrequiredService name
object_pathstringrequiredObject path
interfacestringrequiredInterface that owns the property
property_namestringrequiredProperty name to read

Calls org.freedesktop.DBus.Properties.Get with the specified interface and property name. The returned Variant is unwrapped and JSON-formatted.

JSON-formatted property value with 2-space indentation. Returns "No value returned." if the property read yields no data.

get_property(
bus="session",
service="org.mpris.MediaPlayer2.firefox",
object_path="/org/mpris/MediaPlayer2",
interface="org.mpris.MediaPlayer2.Player",
property_name="PlaybackStatus"
)

Returns:

"Playing"

Set a D-Bus property value.

ParameterTypeDefaultDescription
busstringrequired"session" or "system"
servicestringrequiredService name
object_pathstringrequiredObject path
interfacestringrequiredInterface that owns the property
property_namestringrequiredProperty name to set
valuestringrequiredJSON-encoded value
signaturestringrequiredD-Bus type signature of the property value (e.g. "b" for boolean)

This tool always requires user confirmation regardless of which bus is targeted. Property mutations are state-changing operations and the confirmation prompt is not skippable. See Confirmation Flow for the full resolution chain.

  1. The value JSON string is parsed
  2. The parsed value is wrapped in a Variant with the provided signature
  3. After confirmation, org.freedesktop.DBus.Properties.Set is called
  4. The operation is audit-logged to stderr with the bus, service, interface, property name, value, and signature

Confirmation string: Set {interface}.{property_name} = {value}

set_property(
bus="session",
service="org.mpris.MediaPlayer2.firefox",
object_path="/org/mpris/MediaPlayer2",
interface="org.mpris.MediaPlayer2.Player",
property_name="Volume",
value="0.5",
signature="d"
)

Read all properties on a D-Bus interface.

ParameterTypeDefaultDescription
busstringrequired"session" or "system"
servicestringrequiredService name
object_pathstringrequiredObject path
interfacestringrequiredInterface to read properties from

Calls org.freedesktop.DBus.Properties.GetAll with the specified interface name. Returns all properties as a formatted table.

Markdown table with Property and Value columns, sorted alphabetically by property name. Values are JSON-serialized and truncated at 80 characters to keep the table readable.

## Properties of `org.mpris.MediaPlayer2.Player` at `/org/mpris/MediaPlayer2`
| Property | Value |
|----------|-------|
| `CanControl` | `true` |
| `CanGoNext` | `true` |
| `CanGoPrevious` | `true` |
| `CanPause` | `true` |
| `CanPlay` | `true` |
| `Metadata` | `{"xesam:title": "Starman", "xesam:artist": ["David Bowie"], "mpris:le...` |
| `PlaybackStatus` | `"Playing"` |
| `Volume` | `1.0` |

Returns "No properties found." if the interface exposes no properties.

get_all_properties(
bus="session",
service="org.mpris.MediaPlayer2.firefox",
object_path="/org/mpris/MediaPlayer2",
interface="org.mpris.MediaPlayer2.Player"
)