Text messages, calls and contacts

Read the SMS, call history and contacts stored on a phone from the PC. Each is optional and off until you allow it on the phone.

Three commands read personal data stored on the phone: sms for text messages, calls for call history and contacts for saved contacts. Each one is optional and needs its own permission. Until you allow it, the phone answers NO_PERMISSION. An AI agent only gets them when you name them in --tools.

Turn them on

On the phone, open Droidline's Setup tab. Each command has its own card: SMS, Call history and Contacts. Tap Allow on the ones you need, then allow the dialog Android shows. If you chose "Don't allow" twice, Android stops showing the dialog and the button opens App info instead, where you can turn the permission on yourself.

To turn one off later, tap App info on its card and remove the permission.

Text messages

for m in d.sms(max=5):
    print(m["address"], m["text"])

code = d.sms(contains="verification code", within=300, max=1)
for (const m of await d.sms({ max: 5 })) console.log(m.address, m.text);

const code = await d.sms({ contains: "verification code", within: 300, max: 1 });
foreach (var m in await d.SmsAsync(max: 5))
    Console.WriteLine($"{m.Get<string>("address")} {m.Get<string>("text")}");

var code = await d.SmsAsync(contains: "verification code", within: 300, max: 1);
droidline sms --max 5
droidline sms --contains "verification code" --within 300 --max 1

Messages come newest first. Each has id, address (the number or sender name), text, time (milliseconds since 1970, the phone's clock), box (inbox or sent), read and mms.

OptionWhat it does
boxinbox (default), sent, or all
addressOnly messages whose number or sender contains this. Spaces and dashes are ignored, so 010 1234 finds 010-1234-5678
containsOnly messages whose text contains this, ignoring case
withinOnly messages from the last this many seconds. 0 (default) means any time
maxMost messages to return, 1 to 500. Default 20

sms reads SMS and the text parts of MMS. Pictures in an MMS are left out. Chat messages (RCS, shown as "chat" in Google Messages and Samsung Messages) are kept by the messaging app itself, so sms does not see them. Read those from the screen with dump, or from their notification.

Call history

for c in d.calls(type="missed", within=3600):
    print(c["number"], c["name"], c["time"])
for (const c of await d.calls({ type: "missed", within: 3600 })) console.log(c.number, c.name, c.time);
foreach (var c in await d.CallsAsync(type: "missed", within: 3600))
    Console.WriteLine($"{c.Get<string>("number")} {c.Get<string>("name")}");
droidline calls --type missed --within 3600

Calls come newest first. Each has id, number, name (the saved contact name, empty if there is none), type, time and duration in seconds. type is incoming, outgoing, missed, rejected, blocked or voicemail.

OptionWhat it does
typeall (default), incoming, outgoing, missed, rejected or blocked
numberOnly calls whose number or saved name contains this. Spaces and dashes are ignored
withinOnly calls from the last this many seconds. 0 (default) means any time
maxMost calls to return, 1 to 500. Default 20

Only calls made and received through the phone app are listed. Voice calls inside other apps, such as messengers, usually do not appear.

Contacts

for c in d.contacts("Kim"):
    print(c["name"], c["numbers"], c["emails"])
for (const c of await d.contacts("Kim")) console.log(c.name, c.numbers, c.emails);
foreach (var c in await d.ContactsAsync("Kim"))
    Console.WriteLine($"{c.Get<string>("name")} {string.Join(", ", c.Get<string[]>("numbers")!)}");
droidline contacts Kim

Contacts come sorted by name. Each has id, name, numbers and emails.

OptionWhat it does
queryOnly contacts whose name, number or email contains this, ignoring case. Spaces and dashes in numbers are ignored
maxMost contacts to return, 1 to 500. Default 50

With an AI agent

droidline mcp leaves sms, calls and contacts out even when it lists every other tool, and --read-only alone doesn't add them. Name the ones the agent needs in --tools:

{
  "mcpServers": {
    "droidline": { "command": "droidline", "args": ["mcp", "--tools", "dump,screenshot,touch,sms"] }
  }
}

A batch step can't reach them either unless --tools names them. Text messages often carry one-time codes and bank notices, and call history and contacts describe other people, so give these tools to an agent only when the task needs them.

Tested on

Android 13. Whether newer Android versions hold back one-time codes from the message list has not been checked yet.