AppFunctions の概要

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

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

AppFunctions は、Model Context Protocol(MCP)内のツールに相当するモバイル版として機能します。MCP は従来、エージェントがサーバーサイド ツールに接続する方法を標準化していましたが、AppFunctions は Android アプリに同じメカニズムを提供します。これにより、アプリの機能をオーケストレーション可能な「ツール」として公開し、承認されたアプリ(呼び出し元)が検出して実行し、ユーザーの意図を満たすことができます。呼び出し元は、AppFunction を検出して実行するための 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 アプリは、AppFunction を使用して「メモを作成」や「メッセージを送信」などの機能を利用できるように構築されています。
  • スキーマ生成: AppFunctions Jetpack ライブラリは、アプリで宣言されたすべての AppFunctions をリストする XML スキーマ ファイルを生成します。Android OS はこのファイルを使用して、利用可能な AppFunctions のインデックスを作成します。
  • メタデータの取得: エージェントは、AppFunction メタデータをクエリして取得できます。
  • AppFunction の選択と実行: ユーザーのプロンプトに基づいて、エージェントは適切な AppFunction を適切なパラメータで選択して実行します。
アプリの公開からエージェントの実行までの AppFunctions の一般的なフロー。
図 1: AppFunction が公開され、エージェントによって実行される一般的なフロー。

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
)

サンプル、スキル、テスト エージェント

AppFunctions のスキルアップに役立つ以下のリソースをご用意しました。

よくある質問(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)を実施し、一部のアプリをオンボーディングしています。AppFunctions の統合にご興味がある場合は、こちらの EAP 登録フォームからご登録ください。登録しても、統合全体へのアクセス権が自動的に付与されるわけではありません。アプリが EAP の対象に選ばれた場合、または AppFunctions が一般公開された場合は、メールでお知らせします。

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

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