Commuter Rail stations are generally structured to include the following stop_ids:
- A parent_station stop_id for the entire station, serving Commuter Rail and any other modes using the same station
- A child stop_id for every Commuter Rail track existing at the station
- An "unassigned track" stop_id at stations where there are multiple Commuter Rail tracks
- Other station elements, like doors and navigational nodes, in addition to stop_ids for modes besides Commuter Rail
As of the May 22 Commuter Rail schedule change, Commuter Rail GTFS includes track assignments at most stations, meaning most trips are scheduled to their assigned track.
The "official" way to determine other stop_ids / tracks at the same station would be to identify the stop_ids with the same parent_station value.
I would strongly caution you to NOT use the stop_id as the basis for direction, as there are certain trains that are scheduled to board on a nonstandard track (e.g. during the PM rush hour, outbound Worcester Line trains generally board from Track 2, which is typically used by inbound trains at all other times), meaning your results would display trips using that track, not necessarily in a given direction.
If you're looking to identify trips by direction at a given station, a better approach would be to identify all trips serving any child of the parent station, filtering the results by route as applicable, and then filtering the trips based on the trip's direction_id field.