Package-level declarations

Types

Link copied to clipboard
fun interface AuditSink

Host-supplied sink for tools/call audit records. Implementations must be cheap and non-throwing on the calling path — the protocol invokes record synchronously after each call and swallows exceptions so a broken audit backend never fails a tool. The Room-backed implementation lives in the opt-in droid-mcp-audit module; hosts that don't depend on it pay nothing.

Link copied to clipboard
class DroidMcp

The SDK entry point. Built via DroidMcp.builder / Builder, it owns a ToolRegistry and both transports: an always-on InProcessTransport for on-device LLMs (listTools / callTool) and an optional HttpTransport for desktop MCP clients (startServer).

Link copied to clipboard
interface McpTool

The contract every droid-mcp tool implements. A tool is a single, self-describing capability — its name, description, and parameters are surfaced verbatim through MCP tools/list, and execute services a tools/call.

Link copied to clipboard

The JSON Schema primitive type of a ToolParameter. jsonType is the literal string emitted into the tool's inputSchema ("string", "integer", …).

Link copied to clipboard

Runtime-permission checks shared by every module's provider object. The SDK never requests permissions (the host app owns its permission UX) — it only inspects what has already been granted, so a tool can decline gracefully.

Link copied to clipboard
sealed class PermissionStatus

Uniform shape returned by every special-access module's permissionStatus(context) helper. Lets host apps render permission cards inline (e.g. in chat) before the LLM tries to call a tool, with a single switch over a closed type.

Link copied to clipboard
data class ToolAnnotations(val readOnlyHint: Boolean = false, val destructiveHint: Boolean = false, val idempotentHint: Boolean = false, val openWorldHint: Boolean = false, val title: String? = null)

Behavioural hints attached to a tool, mirroring the MCP tools/list annotation fields. They are advisory metadata for clients and LLMs — the SDK does not enforce them — but the HTTP transport's readOnly server mode uses readOnlyHint to decide which tools to expose.

Link copied to clipboard
data class ToolCallAudit(val timestamp: Long, val toolName: String, val clientLabel: String?, val argumentsJson: String?, val success: Boolean, val errorMessage: String?, val durationMs: Long)

One audited tools/call. Captured by McpProtocolImpl after the tool runs and handed to the host's AuditSink.

Link copied to clipboard
@Serializable
data class ToolParameter(val name: String, val description: String, val type: ParameterType, val required: Boolean = false)

A single declared input to an McpTool. The list of these on a tool is compiled into the inputSchema advertised by MCP tools/list, so name and type are part of the wire contract.

Link copied to clipboard

Thread-safe collection of registered McpTools, keyed by McpTool.name. Backed by a ConcurrentHashMap so tools can be registered and invoked concurrently. Also tracks a host-controlled runtime gate (see setDisabledTools) that hides/blocks tools without unregistering them.

Link copied to clipboard
data class ToolResult(val isSuccess: Boolean, val data: Map<String, Any?>?, val errorMessage: String?)

The outcome of an McpTool.execute call. Exactly one of data / errorMessage is meaningful, selected by isSuccess. The protocol layer maps a result onto the MCP tools/call response: success becomes content, failure becomes an isError: true payload.

Properties

Link copied to clipboard

The droid-mcp SDK version, reported as the server version in the MCP initialize handshake and broadcast over mDNS. Keep in sync with the Gradle VERSION_NAME.