AppFunctions の概要

AppFunctions は、Android MCP の統合を簡素化するための Jetpack ライブラリ が付属する Android プラットフォーム API です。これにより、アプリはデバイス上の MCP サーバーのように動作し、Google Gemini などのエージェントやアシスタントとともに、プロアクティブな機能で使用するツールとして機能する関数を提供できます。 2026 年 5 月の時点で、Gemini との AppFunctions の統合は、Trusted Tester による限定公開プレビュー版です。AppFunctions と開発ツールを使用できるように、アプリの準備を今すぐ開始できます。

これらの AppFunctions を定義することで、アプリは Android OS に組み込まれたレジストリにサービス、データ、アクションを提供できるようになり、ユーザーはエージェントとシステムレベルの操作を通じてタスクを完了できます。

AppFunctions は、Model Context Protocol (MCP)内のツールに相当するモバイル版です。MCP は従来、エージェントがサーバーサイド ツールに接続する方法を標準化していましたが、AppFunctions は Android アプリに同じメカニズムを提供します。これにより、アプリの機能をオーケストレーション可能な「ツール」として公開できます。認可されたアプリ(呼び出し元)は、このツールを検出して実行し、ユーザーの意図を実現できます。呼び出し元は、AppFunctions を検出して実行するための EXECUTE_APP_FUNCTIONS 権限を持っている必要があり、エージェント、アプリ、Gemini などの AI アシスタントを含めることができます。

AppFunctions は、Android 16 以降を搭載したデバイスで利用できます。

サンプル ユースケース

AppFunctions は、タスクを自動化し、ユーザー操作を効率化するための強力なメカニズムを提供します。アプリの機能を公開することで、ユーザーは自然言語を使用して複雑な目標を達成できます。多くの場合、UI を使用したステップバイステップの手動操作は不要になります。

次のシナリオでは、AppFunctions を使用してさまざまなアプリ カテゴリでエクスペリエンスを向上させる方法を示します。

  • タスク管理と生産性

    • ユーザー リクエスト: "今日の午後 5 時に職場で荷物を受け取るようにリマインドして"。
    • AppFunction アクション: 呼び出し元は、関連するタスク 管理アプリを特定し、関数を呼び出してタスクを作成します。ユーザーのプロンプトに基づいて、タイトル、時間、場所のフィールドが自動的に 入力されます。
    /**
    *   Create a new task or reminder with a title, due time, and location.
    *
    *   @param context The execution context provided by the system.
    *   @param title The descriptive title of the task (e.g., "Pick up my package").
    *   @param dueDateTime The specific date and time when the task should be completed.
    *   @param location The physical location associated with the task (e.g., "Work").
    *   @return The created Task
    */
    @AppFunction(isDescribedByKDoc = true)
    suspend fun createTask(
        context: AppFunctionContext,
        title: String,
        dueDateTime: LocalDateTime? = null,
        location: String? = null
    ) : Task
    
  • メディアとエンターテイメント

    • ユーザー リクエスト: "今年のトップ ジャズ アルバムで新しいプレイリストを作成して"。
    • AppFunction アクション: 呼び出し元は、音楽アプリ内でプレイリスト作成関数を実行し、「2026 年のトップ ジャズ アルバム」などのコンテキストをクエリとして渡して、プレイリストをすぐに生成します。
    /**
    *   Create a new music playlist based on a natural language query.
    *
    *   @param context The execution context provided by the system.
    *   @param query The description used to generate the playlist (e.g., "top jazz albums from 2026").
    *   @return The final created playlist based on songs.
    */
    @AppFunction(isDescribedByKDoc = true)
    suspend fun createPlaylistFromQuery(
        context: AppFunctionContext,
        query: String
    ): Playlist
    
  • クロスアプリ ワークフロー

    • ユーザー リクエスト: "Lisa のメールから麺のレシピを見つけて、 材料をショッピング リストに追加して"。
    • AppFunction アクション: このリクエストでは、複数のアプリの関数を使用します。 まず、呼び出し元はメールアプリの検索機能を使用してコンテンツを取得します。次に、関連する材料を抽出し、ショッピング リスト アプリの関数を呼び出してユーザーのリストに入力します。
    /**
    *   Search for emails matching a query or sender name to retrieve content like recipes.
    *
    *   @param context The execution context provided by the system.
    *   @param query The search term or contact name (e.g., "Lisa noodle recipe").
    *   @return A list of matching email summaries containing the requested information.
    */
    @AppFunction(isDescribedByKDoc = true)
    suspend fun searchEmails(
        context: AppFunctionContext,
        query: String
    ): List<EmailSummary>
    
    /**
    *   Add a list of items or ingredients to the user's active shopping list.
    *
    *   @param context The execution context provided by the system.
    *   @param items The names of the ingredients or products to add to the list.
    *   @return The final shopping list with new items added
    */
    @AppFunction(isDescribedByKDoc = true)
    suspend fun addItemsToShoppingList(
        context: AppFunctionContext,
        items: List<String>
    ): ShoppingList
    
  • カレンダーとスケジュール

    • ユーザー リクエスト: "来週 月曜日の午後 6 時に母の誕生日パーティーをカレンダーに追加して"。
    • AppFunction アクション: 承認されたエージェント アプリは、カレンダー アプリの「予定を作成」関数を呼び出し、「来週 月曜日」や「午後 6 時」などの関連するコンテキストを解析して、ユーザーが手動でカレンダーを 開くことなくエントリを作成します。
    /**
    *   Schedule a new event on the user's primary calendar.
    *
    *   @param context The execution context provided by the system.
    *   @param title The name of the calendar event (e.g., "Mom's birthday party").
    *   @param startDateTime The specific date and time the event is scheduled to begin.
    *   @return The created Event object.
    */
    @AppFunction(isDescribedByKDoc = true)
    suspend fun createCalendarEvent(
        context: AppFunctionContext,
        title: String,
        startDateTime: LocalDateTime
    ): Event
    

AppFunctions の仕組み

次の図は、アプリが AppFunctions をエージェントと共有し、その後実行される一般的なフローを示しています。エージェントは、ユーザー リクエストを処理する際に、サーバーサイドのリモート MCP ツールとローカルの AppFunctions の両方を考慮する可能性があります。ローカルの AppFunctions を使用する詳細なフローは次のとおりです。

  • AppFunction の宣言: Android アプリは、AppFunctions を使用して、「メモを作成」や「メッセージを送信」などの機能を利用できるように構築されています。
  • スキーマの生成: AppFunctions Jetpack ライブラリは、アプリで宣言されたすべての AppFunctions を一覧表示する XML スキーマ ファイルを生成します。Android OS は、このファイルを使用して、利用可能な AppFunctions のインデックスを作成します。
  • メタデータの取得: エージェントは、AppFunction メタデータを クエリして取得できます。
  • AppFunction の選択と実行: エージェントは、ユーザーのプロンプトに基づいて、適切なパラメータを使用して適切な AppFunction を 選択して実行します 。
アプリの公開からエージェントの実行までの AppFunctions の一般的なフロー。
図 1: AppFunctions が公開され、 エージェントによって実行される一般的なフロー。

AppFunctions Jetpack ライブラリを使用すると、アプリの機能を簡単に公開できます。 アノテーション プロセッサを使用して、エージェントが利用できるようにする関数にアノテーションを付けます。呼び出し元は、これらのインデックス付き 関数をAppFunctionManager使用して検出および呼び出すことができます。

関数を呼び出す前に、呼び出し元は AppFunctionManager のインスタンスを取得して、デバイスが AppFunctions 機能をサポートしていることを確認する必要があります。サポートされている場合、呼び出し元は isAppFunctionEnabled(packageName,functionId) を使用して、特定の 関数がターゲット アプリ内で有効になっているかどうかを確認できます。他のパッケージの関数のステータスをクエリするには、 android.permission.EXECUTE_APP_FUNCTIONSpermission が必要です。

アプリで AppFunction 機能がサポートされているかどうかを確認する必要はありません。これは Jetpack ライブラリ内で自動的に処理されます。たとえば、 AppFunctionManager は、機能がサポートされているかどうかを確認できます。

次に、メモの作成、編集、一覧表示の機能を備えたメモアプリの AppFunctions の例を示します。

/**
 * A note app's [AppFunction]s.
 */
class NoteFunctions(
    private val noteRepository: NoteRepository
) {
    /**
     * Lists all available notes.
     *
     * @param appFunctionContext The context in which the AppFunction is executed.
     */
    @AppFunction(isDescribedByKDoc = true)
    suspend fun listNotes(appFunctionContext: AppFunctionContext): List<Note>? {
        return noteRepository.appNotes.ifEmpty { null }?.toList()
    }

    /**
     * Adds a new note to the app.
     *
     * @param appFunctionContext The context in which the AppFunction is executed.
     * @param title The title of the note.
     * @param content The note's content.
     */
    @AppFunction(isDescribedByKDoc = true)
    suspend fun createNote(
        appFunctionContext: AppFunctionContext,
        title: String,
        content: String
    ): Note {
        return noteRepository.createNote(title, content)
    }

    /**
     * Edits a single note.
     *
     * @param appFunctionContext The context in which the AppFunction is executed.
     * @param noteId The target note's ID.
     * @param title The note's title if it should be updated.
     * @param content The new content if it should be updated.
     */
    @AppFunction(isDescribedByKDoc = true)
    suspend fun editNote(
        appFunctionContext: AppFunctionContext,
        noteId: Int,
        title: String?,
        content: String?,
    ): Note? {
        return noteRepository.updateNote(noteId, title, content)
    }
}

/**
 * A note.
 */
@AppFunctionSerializable(isDescribedByKDoc = true)
data class Note(
    /** The note's identifier */
    val id: Int,
    /** The note's title */
    val title: String,
    /** The note's content */
    val content: String
)

よくある質問(FAQ)

次のセクションでは、AppFunctions に関するよくある質問について説明します。

私はアプリ デベロッパーです。AppFunctions を今すぐ実装できますか?

はい。前のセクションで説明したガイダンスに沿って、アプリ内で AppFunctions を実装してテストできます。

AppFunctions と MCP の違いは何ですか?

どちらも AI エージェントがツールをオーケストレーションできますが、アーキテクチャ、レイテンシ、デベロッパーに必要な作業量に大きな違いがあります。AppFunctions は、Android 専用の OS レベルの組み込みフックで、ローカルで実行されます。一方、標準の MCP サーバーは、クラウド実行とネットワーク ラウンドトリップに依存するプラットフォームに依存しないソリューションです。

つまり、AppFunctions を使用して開発すると、デバイス上の既存のアプリの状態を直接使用でき、Android アプリの外部でサービスを維持する必要はありません。

アプリに AppFunctions を実装しましたが、システム エージェントからアクセスできません。なぜですか?

AppFunctions は試験運用版の機能です。この試験運用段階では、全体的なエクスペリエンスの品質を慎重に評価するため、限られた数のアプリとシステム エージェントのみがパイプライン全体にアクセスできます。

AppFunctions の一般提供に向けてアプリを準備するにはどうすればよいですか?

エージェントによる自動化に公開するアプリの機能を検討してください。 アプリに AppFunctions を実装できます。これを行うには、このページの前のセクションの手順に沿って、adb shell cmd app_function list-app-functions を呼び出してデバイスに登録されていることを確認します。

エンドツーエンドのエージェント デベロッパー エクスペリエンスに早期アクセスできますか?

Android で AppFunctions を本番環境にリリースするために必要なエンドツーエンドのデベロッパー エクスペリエンスをテストするアプリを選択して、早期アクセス プログラム(EAP)を実施しています。この EAP 登録フォームから、 AppFunctions の統合に関心があることを登録できます。関心をお寄せいただいても、統合全体へのアクセス権が自動的に付与されるわけではありません。アプリが EAP に選ばれた場合、または AppFunctions が一般公開された場合は、メールでお知らせします。

AppFunctions に関するフィードバックを提供するにはどうすればよいですか?

問題を報告し、 早期アクセス プログラム フォームに関心をお寄せいただくことで、API に関するフィードバックを提供できます。