Team Fortress 2 server status checker
Team Fortress 2 uses the same Source query protocol as the rest of the Valve lineup, on the same port players use.
Which ports a Team Fortress 2 server needs
One UDP port covers both gameplay and queries. As with CS2, public listing additionally requires a game server login token — a server can be perfectly reachable and answer this check while still being absent from the in-game browser.
If it still shows offline
If the query times out, check the UDP rule first. If it answers but the server is unlisted, the token is the cause. Heavily customised servers can also be slow to start; the query does not respond until the map is loaded.