MCP Apps
    Preparing search index...

    Function getToolEntrypoints

    • Read the entrypoints that a tool declares in _meta.ui.entrypoints.

      Skips malformed entries (anything but an object with a string type) and keeps the rest, whereas McpUiToolMetaSchema rejects the whole _meta.ui object for one malformed entry. Returns an empty list for a tool without a valid UI resource. The caller still has to leave out the types that it does not support. Repeated types are kept: what a repeat means depends on the type.

      Parameters

      • tool: Partial<Tool>

        A tool object with optional _meta property

      Returns McpUiEntrypoint[]

      The well-formed entrypoints, in the order in which the tool declares them

      const { tools } = await client.listTools();

      // Offer these in the host's own UI, e.g. in a list of apps
      const launchable = tools.filter((tool) =>
      getToolEntrypoints(tool).some((entrypoint) => entrypoint.type === "global"),
      );

      // When the user picks one, open it with no arguments
      // and render its view as for any other tool call
      const result = await client.callTool({
      name: launchable[0].name,
      arguments: {},
      });