MCP Apps
    Preparing search index...

    Function fileMatchesEntrypoint

    • Check whether a file matches a "file" entrypoint: an item of its extensions matches the end of the file's name, or an item of its mimeTypes matches the file's media type. Both are compared without regard to case, and parameters of the file's media type are ignored.

      Returns false for an entrypoint of another type or a malformed one, and skips list items that are neither a dot-prefixed extension nor a media type (type/subtype, or a whole type such as image/*; a wildcard in place of the type matches nothing).

      Parameters

      Returns boolean

      const file = { name: "tune.abc", mimeType: "text/vnd.abc" };
      const { tools } = await client.listTools();

      // Let the user choose among these, next to the host's own viewer
      const handlers = tools.filter(
      (tool) =>
      getToolFileArgument(tool) !== undefined &&
      getToolEntrypoints(tool).some((entrypoint) =>
      fileMatchesEntrypoint(file, entrypoint),
      ),
      );