Skip to content

Comments

Add CallFunctionMessage and functionResponse.#644

Open
jgindin wants to merge 7 commits intogoogle:mainfrom
jgindin:call-function-message
Open

Add CallFunctionMessage and functionResponse.#644
jgindin wants to merge 7 commits intogoogle:mainfrom
jgindin:call-function-message

Conversation

@jgindin
Copy link
Collaborator

@jgindin jgindin commented Feb 19, 2026

Description

Enables the server to request a function be invoked on the client. The server can specify whether it wants a response or not.

The new CallFunctionMessage can be sent at any time from the server, and is not associated with any surface. The function call leverages the existing FunctionCall type, but restricts the arguments and return type to scalars (or arrays of scalars). Specifically, neither data binding nor the use of client side function calls is allowed.

CallFunctionMessages are not associated with any surface.

To ensure the response (including any errors) can be properly associated with the function call, a callId must be specified with the CallFunctionMessage.

The error response has been updated to require either a surfaceId or a callId.

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@jgindin jgindin requested a review from wrenj February 20, 2026 19:22
@jgindin jgindin requested a review from gspencergoog February 23, 2026 18:32
Enables the server to request a function be invoked on the client. The
server can specify whether it wants a response or not.

The new `CallFunctionMessage` can be sent at any time from the server,
and is not associated with any surface. The function call leverages the
existing `FunctionCall` type, but restricts the arguments and return
type to scalars (or arrays of scalars). Specifically, neither data
binding nor the use of client side function calls is allowed.

`CallFunctionMessage`s are not associated with any surface.

To ensure the response (including any errors) can be properly associated
with the function call, a `callId` must be specified with the
`CallFunctionMessage`.

The `error` response has been updated to require _either_ a `surfaceId`
_or_ a `callId`.
callId --> functionCallId
allowRemote --> callableFrom
Don't require `callableFrom`, but provide a default value.
  * Remove the `ScalarType` and `ScalarTypeArray` as they were only
    used from a single place. Just inline the values.
  * Declare the `FunctionCall` `returnType` as a simple `enum` instead
    of the `anyOf` combining references and consts.
  * Since `FunctionCall` specifies a default value for `callableFrom`,
    there's no reason to repeat it.
  * `openUrl` is client only now; if someone really wants to enable
    the server to direct the client to open a URL, they can add that
    function themselves (and worry about the security implications).

Updated the `run_tests.py` to allow the test cases to specify a
different catalog. This is used for the call_function_message.json
to provide a catalog where a function has `callableFrom` set to
`clientOrRemote` and another function specifies `remoteOnly`.
@jgindin jgindin force-pushed the call-function-message branch from f1652d9 to 6190d40 Compare February 24, 2026 18:35
1. `DynamicStringList`: The return type if using a `FunctionCall`
    needs to be one of the types declared by `FunctionCall`, so revert
    back to `array`
2. `CallFunctionMessage`: Make the `description` property on
    `callableFrom` match what's in the `FunctionCall`.
@jgindin jgindin requested a review from gspencergoog February 24, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants