diff --git a/backend/agents/event_agent.go b/backend/agents/event_agent.go index 8935b59..831976a 100644 --- a/backend/agents/event_agent.go +++ b/backend/agents/event_agent.go @@ -88,7 +88,7 @@ const eventTools = ` }, "startDateTime": { "type": "string", - "description": "The event's start date and time in ISO 8601 format (e.g., '2025-04-18T10:00:00Z' or '2025-04-18T11:00:00+01:00'). Include if available." + "description": "The event's start date and time in ISO 8601 format (e.g., '2025-04-18T10:00:00Z'). Include if available." }, "endDateTime": { "type": "string", @@ -96,7 +96,7 @@ const eventTools = ` }, "locationId": { "type": "string", - "description": "The unique identifier (UUID or similar) for the event's location. Only include this if a location was specified for the event AND its ID was successfully retrieved using the getEventLocationId tool." + "description": "The unique identifier (UUID or similar) for the event's location. Use this if available, do not invent it." } }, "required": ["name"] @@ -140,6 +140,7 @@ type createEventArguments struct { StartDateTime *string `json:"startDateTime"` EndDateTime *string `json:"endDateTime"` OrganizerName *string `json:"organizerName"` + LocationID *string `json:"locationId"` } type linkEventArguments struct { EventID string `json:"eventId"` @@ -182,10 +183,16 @@ func NewEventAgent(log *log.Logger, eventsModel models.EventModel, locationModel return model.Events{}, err } + locationId, err := uuid.Parse(*args.LocationID) + if err != nil { + return model.Events{}, err + } + events, err := eventsModel.Save(ctx, info.UserId, model.Events{ Name: args.Name, StartDateTime: &startTime, EndDateTime: &endTime, + LocationID: &locationId, }) if err != nil { diff --git a/backend/models/events.go b/backend/models/events.go index d473605..6c16ad1 100644 --- a/backend/models/events.go +++ b/backend/models/events.go @@ -31,8 +31,8 @@ func (m EventModel) List(ctx context.Context, userId uuid.UUID) ([]model.Events, func (m EventModel) Save(ctx context.Context, userId uuid.UUID, event model.Events) (model.Events, error) { // TODO tx here insertEventStmt := Events. - INSERT(Events.Name, Events.Description, Events.StartDateTime, Events.EndDateTime). - VALUES(event.Name, event.Description, event.StartDateTime, event.EndDateTime). + INSERT(Events.Name, Events.Description, Events.StartDateTime, Events.EndDateTime, Events.LocationID). + VALUES(event.Name, event.Description, event.StartDateTime, event.EndDateTime, event.LocationID). RETURNING(Events.AllColumns) insertedEvent := model.Events{}