Skip to content

SystemUtilitySkill.LookupCampuses returns wrong longitude (copy of latitude) and an idKey of 0 for every campus location #7001

Description

@pbassham

Description

The AI Agent tool LookupCampuses (SystemUtilitySkill) returns incorrect data in the location object of every campus. There are two distinct bugs in Rock.AI.Agent/Skills/SystemUtilitySkill.LookupCampuses.cs:

1. geographyPoint.longitude is a copy of the latitude. Line 79 (at tag 19.4.4) passes Latitude twice to the GeographyPoint constructor:

GeographyPoint = ( c.Location.Latitude.HasValue && c.Location.Longitude.HasValue )
    ? new GeographyPoint( c.Location.Latitude.Value, c.Location.Latitude.Value )
    : null

2. Every campus location serializes the same idKey. The LocationResult initializer (lines 71–80) never assigns Id, which is [JsonIgnore]'d on EntityResultBase and exposed only as IdKey => Id.AsIdKey(). Since Id stays 0, every campus's location emits the IdKey of zero (e.g. 3qrvpWB8LM), which an agent could mistake for a real, shared location reference.

Both bugs are present in 19.4.4 (latest release) and on current develop (checked 2026-08-27). The v20.0.x -pre tags predate this skill, so no released or pre-released version has a fix.

Actual Behavior

Calling the LookupCampuses MCP/agent tool returns, for each campus, e.g.:

"location": {
  "geographyPoint": { "latitude": 32.73431, "longitude": 32.73431 },
  "idKey": "3qrvpWB8LM"
}

The longitude 32.73431 places a Fort Worth, TX campus in the Mediterranean Sea (actual longitude is roughly -97.4), and all campuses share the identical location idKey.

Expected Behavior

geographyPoint.longitude should be the location's actual longitude:

new GeographyPoint( c.Location.Latitude.Value, c.Location.Longitude.Value )

and the location's idKey should either be the real Location IdKey (set Id from the campus's LocationId in the initializer) or be omitted when no Id is available, rather than emitting the IdKey of 0.

Steps to Reproduce

  • On a Rock 19.4+ instance with AI Agents configured, create an agent (MCP or chat) with the System Utility skill enabled, on an instance whose campuses have geocoded locations
  • Invoke the LookupCampuses tool from the agent/MCP client
  • Inspect the location object of any returned campus
  • Observe longitude equals latitude, and every campus's location has the same idKey

Issue Confirmation

  • Perform a search on the Github Issues to see if your bug is already reported.
  • Reproduced the problem on a fresh install or on the demo site.

Rock Version

19.4.4 (also present on develop as of 2026-08-27)

Client Culture Setting

en-US

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions