Are event handlers necessary for RPC?

Are event handlers now necessary? I have workers I don't want to expose to fetch and only want to invoke via RPC.

Why cant I do something like:
import { WorkerEntrypoint } from "cloudflare:workers";

export default class extends WorkerEntrypoint {
    async add(a: number, b: number) {
        return a + b;
    }
}

without getting this error:
The uploaded script has no registered event handlers. Please visit the following website for more information:
Was this page helpful?