feat(ui): add content editor components for skills and thoughts
Some checks failed
CI / build-and-test (push) Failing after -31m24s

* Implement ContentEditorField for inline editing of content
* Create ContentEditorModal for editing content in a modal
* Introduce FormerShell for managing forms related to skills and thoughts
* Enhance SkillsPage and ThoughtsPage with new components for better content management
This commit is contained in:
2026-05-02 19:35:27 +02:00
parent 442cc3ef53
commit 9e6d05e055
59 changed files with 4727 additions and 3430 deletions

View File

@@ -1,212 +1,212 @@
package tools
import (
"context"
"strings"
"time"
// import (
// "context"
// "strings"
// "time"
"github.com/google/uuid"
"github.com/modelcontextprotocol/go-sdk/mcp"
// "github.com/google/uuid"
// "github.com/modelcontextprotocol/go-sdk/mcp"
"git.warky.dev/wdevs/amcs/internal/store"
ext "git.warky.dev/wdevs/amcs/internal/types"
)
// "git.warky.dev/wdevs/amcs/internal/store"
// ext "git.warky.dev/wdevs/amcs/internal/types"
// )
type CalendarTool struct {
store *store.DB
}
// type CalendarTool struct {
// store *store.DB
// }
func NewCalendarTool(db *store.DB) *CalendarTool {
return &CalendarTool{store: db}
}
// func NewCalendarTool(db *store.DB) *CalendarTool {
// return &CalendarTool{store: db}
// }
// add_family_member
// // add_family_member
type AddFamilyMemberInput struct {
Name string `json:"name" jsonschema:"person's name"`
Relationship string `json:"relationship,omitempty" jsonschema:"e.g. self, spouse, child, parent"`
BirthDate *time.Time `json:"birth_date,omitempty"`
Notes string `json:"notes,omitempty"`
}
// type AddFamilyMemberInput struct {
// Name string `json:"name" jsonschema:"person's name"`
// Relationship string `json:"relationship,omitempty" jsonschema:"e.g. self, spouse, child, parent"`
// BirthDate *time.Time `json:"birth_date,omitempty"`
// Notes string `json:"notes,omitempty"`
// }
type AddFamilyMemberOutput struct {
Member ext.FamilyMember `json:"member"`
}
// type AddFamilyMemberOutput struct {
// Member ext.FamilyMember `json:"member"`
// }
func (t *CalendarTool) AddMember(ctx context.Context, _ *mcp.CallToolRequest, in AddFamilyMemberInput) (*mcp.CallToolResult, AddFamilyMemberOutput, error) {
if strings.TrimSpace(in.Name) == "" {
return nil, AddFamilyMemberOutput{}, errRequiredField("name")
}
member, err := t.store.AddFamilyMember(ctx, ext.FamilyMember{
Name: strings.TrimSpace(in.Name),
Relationship: strings.TrimSpace(in.Relationship),
BirthDate: in.BirthDate,
Notes: strings.TrimSpace(in.Notes),
})
if err != nil {
return nil, AddFamilyMemberOutput{}, err
}
return nil, AddFamilyMemberOutput{Member: member}, nil
}
// func (t *CalendarTool) AddMember(ctx context.Context, _ *mcp.CallToolRequest, in AddFamilyMemberInput) (*mcp.CallToolResult, AddFamilyMemberOutput, error) {
// if strings.TrimSpace(in.Name) == "" {
// return nil, AddFamilyMemberOutput{}, errRequiredField("name")
// }
// member, err := t.store.AddFamilyMember(ctx, ext.FamilyMember{
// Name: strings.TrimSpace(in.Name),
// Relationship: strings.TrimSpace(in.Relationship),
// BirthDate: in.BirthDate,
// Notes: strings.TrimSpace(in.Notes),
// })
// if err != nil {
// return nil, AddFamilyMemberOutput{}, err
// }
// return nil, AddFamilyMemberOutput{Member: member}, nil
// }
// list_family_members
// // list_family_members
type ListFamilyMembersInput struct{}
// type ListFamilyMembersInput struct{}
type ListFamilyMembersOutput struct {
Members []ext.FamilyMember `json:"members"`
}
// type ListFamilyMembersOutput struct {
// Members []ext.FamilyMember `json:"members"`
// }
func (t *CalendarTool) ListMembers(ctx context.Context, _ *mcp.CallToolRequest, _ ListFamilyMembersInput) (*mcp.CallToolResult, ListFamilyMembersOutput, error) {
members, err := t.store.ListFamilyMembers(ctx)
if err != nil {
return nil, ListFamilyMembersOutput{}, err
}
if members == nil {
members = []ext.FamilyMember{}
}
return nil, ListFamilyMembersOutput{Members: members}, nil
}
// func (t *CalendarTool) ListMembers(ctx context.Context, _ *mcp.CallToolRequest, _ ListFamilyMembersInput) (*mcp.CallToolResult, ListFamilyMembersOutput, error) {
// members, err := t.store.ListFamilyMembers(ctx)
// if err != nil {
// return nil, ListFamilyMembersOutput{}, err
// }
// if members == nil {
// members = []ext.FamilyMember{}
// }
// return nil, ListFamilyMembersOutput{Members: members}, nil
// }
// add_activity
// // add_activity
type AddActivityInput struct {
Title string `json:"title" jsonschema:"activity title"`
ActivityType string `json:"activity_type,omitempty" jsonschema:"e.g. sports, medical, school, social"`
FamilyMemberID *uuid.UUID `json:"family_member_id,omitempty" jsonschema:"leave empty for whole-family activities"`
DayOfWeek string `json:"day_of_week,omitempty" jsonschema:"for recurring: monday, tuesday, etc."`
StartTime string `json:"start_time,omitempty" jsonschema:"HH:MM format"`
EndTime string `json:"end_time,omitempty" jsonschema:"HH:MM format"`
StartDate *time.Time `json:"start_date,omitempty"`
EndDate *time.Time `json:"end_date,omitempty" jsonschema:"for recurring activities, when they end"`
Location string `json:"location,omitempty"`
Notes string `json:"notes,omitempty"`
}
// type AddActivityInput struct {
// Title string `json:"title" jsonschema:"activity title"`
// ActivityType string `json:"activity_type,omitempty" jsonschema:"e.g. sports, medical, school, social"`
// FamilyMemberID *uuid.UUID `json:"family_member_id,omitempty" jsonschema:"leave empty for whole-family activities"`
// DayOfWeek string `json:"day_of_week,omitempty" jsonschema:"for recurring: monday, tuesday, etc."`
// StartTime string `json:"start_time,omitempty" jsonschema:"HH:MM format"`
// EndTime string `json:"end_time,omitempty" jsonschema:"HH:MM format"`
// StartDate *time.Time `json:"start_date,omitempty"`
// EndDate *time.Time `json:"end_date,omitempty" jsonschema:"for recurring activities, when they end"`
// Location string `json:"location,omitempty"`
// Notes string `json:"notes,omitempty"`
// }
type AddActivityOutput struct {
Activity ext.Activity `json:"activity"`
}
// type AddActivityOutput struct {
// Activity ext.Activity `json:"activity"`
// }
func (t *CalendarTool) AddActivity(ctx context.Context, _ *mcp.CallToolRequest, in AddActivityInput) (*mcp.CallToolResult, AddActivityOutput, error) {
if strings.TrimSpace(in.Title) == "" {
return nil, AddActivityOutput{}, errRequiredField("title")
}
activity, err := t.store.AddActivity(ctx, ext.Activity{
FamilyMemberID: in.FamilyMemberID,
Title: strings.TrimSpace(in.Title),
ActivityType: strings.TrimSpace(in.ActivityType),
DayOfWeek: strings.ToLower(strings.TrimSpace(in.DayOfWeek)),
StartTime: strings.TrimSpace(in.StartTime),
EndTime: strings.TrimSpace(in.EndTime),
StartDate: in.StartDate,
EndDate: in.EndDate,
Location: strings.TrimSpace(in.Location),
Notes: strings.TrimSpace(in.Notes),
})
if err != nil {
return nil, AddActivityOutput{}, err
}
return nil, AddActivityOutput{Activity: activity}, nil
}
// func (t *CalendarTool) AddActivity(ctx context.Context, _ *mcp.CallToolRequest, in AddActivityInput) (*mcp.CallToolResult, AddActivityOutput, error) {
// if strings.TrimSpace(in.Title) == "" {
// return nil, AddActivityOutput{}, errRequiredField("title")
// }
// activity, err := t.store.AddActivity(ctx, ext.Activity{
// FamilyMemberID: in.FamilyMemberID,
// Title: strings.TrimSpace(in.Title),
// ActivityType: strings.TrimSpace(in.ActivityType),
// DayOfWeek: strings.ToLower(strings.TrimSpace(in.DayOfWeek)),
// StartTime: strings.TrimSpace(in.StartTime),
// EndTime: strings.TrimSpace(in.EndTime),
// StartDate: in.StartDate,
// EndDate: in.EndDate,
// Location: strings.TrimSpace(in.Location),
// Notes: strings.TrimSpace(in.Notes),
// })
// if err != nil {
// return nil, AddActivityOutput{}, err
// }
// return nil, AddActivityOutput{Activity: activity}, nil
// }
// get_week_schedule
// // get_week_schedule
type GetWeekScheduleInput struct {
WeekStart time.Time `json:"week_start" jsonschema:"start of the week (Monday) to retrieve"`
}
// type GetWeekScheduleInput struct {
// WeekStart time.Time `json:"week_start" jsonschema:"start of the week (Monday) to retrieve"`
// }
type GetWeekScheduleOutput struct {
Activities []ext.Activity `json:"activities"`
}
// type GetWeekScheduleOutput struct {
// Activities []ext.Activity `json:"activities"`
// }
func (t *CalendarTool) GetWeekSchedule(ctx context.Context, _ *mcp.CallToolRequest, in GetWeekScheduleInput) (*mcp.CallToolResult, GetWeekScheduleOutput, error) {
activities, err := t.store.GetWeekSchedule(ctx, in.WeekStart)
if err != nil {
return nil, GetWeekScheduleOutput{}, err
}
if activities == nil {
activities = []ext.Activity{}
}
return nil, GetWeekScheduleOutput{Activities: activities}, nil
}
// func (t *CalendarTool) GetWeekSchedule(ctx context.Context, _ *mcp.CallToolRequest, in GetWeekScheduleInput) (*mcp.CallToolResult, GetWeekScheduleOutput, error) {
// activities, err := t.store.GetWeekSchedule(ctx, in.WeekStart)
// if err != nil {
// return nil, GetWeekScheduleOutput{}, err
// }
// if activities == nil {
// activities = []ext.Activity{}
// }
// return nil, GetWeekScheduleOutput{Activities: activities}, nil
// }
// search_activities
// // search_activities
type SearchActivitiesInput struct {
Query string `json:"query,omitempty" jsonschema:"search text matching title or notes"`
ActivityType string `json:"activity_type,omitempty" jsonschema:"filter by type"`
FamilyMemberID *uuid.UUID `json:"family_member_id,omitempty" jsonschema:"filter by family member"`
}
// type SearchActivitiesInput struct {
// Query string `json:"query,omitempty" jsonschema:"search text matching title or notes"`
// ActivityType string `json:"activity_type,omitempty" jsonschema:"filter by type"`
// FamilyMemberID *uuid.UUID `json:"family_member_id,omitempty" jsonschema:"filter by family member"`
// }
type SearchActivitiesOutput struct {
Activities []ext.Activity `json:"activities"`
}
// type SearchActivitiesOutput struct {
// Activities []ext.Activity `json:"activities"`
// }
func (t *CalendarTool) SearchActivities(ctx context.Context, _ *mcp.CallToolRequest, in SearchActivitiesInput) (*mcp.CallToolResult, SearchActivitiesOutput, error) {
activities, err := t.store.SearchActivities(ctx, in.Query, in.ActivityType, in.FamilyMemberID)
if err != nil {
return nil, SearchActivitiesOutput{}, err
}
if activities == nil {
activities = []ext.Activity{}
}
return nil, SearchActivitiesOutput{Activities: activities}, nil
}
// func (t *CalendarTool) SearchActivities(ctx context.Context, _ *mcp.CallToolRequest, in SearchActivitiesInput) (*mcp.CallToolResult, SearchActivitiesOutput, error) {
// activities, err := t.store.SearchActivities(ctx, in.Query, in.ActivityType, in.FamilyMemberID)
// if err != nil {
// return nil, SearchActivitiesOutput{}, err
// }
// if activities == nil {
// activities = []ext.Activity{}
// }
// return nil, SearchActivitiesOutput{Activities: activities}, nil
// }
// add_important_date
// // add_important_date
type AddImportantDateInput struct {
Title string `json:"title" jsonschema:"description of the date"`
DateValue time.Time `json:"date_value" jsonschema:"the date"`
FamilyMemberID *uuid.UUID `json:"family_member_id,omitempty"`
RecurringYearly bool `json:"recurring_yearly,omitempty" jsonschema:"if true, reminds every year"`
ReminderDaysBefore int `json:"reminder_days_before,omitempty" jsonschema:"how many days before to remind (default: 7)"`
Notes string `json:"notes,omitempty"`
}
// type AddImportantDateInput struct {
// Title string `json:"title" jsonschema:"description of the date"`
// DateValue time.Time `json:"date_value" jsonschema:"the date"`
// FamilyMemberID *uuid.UUID `json:"family_member_id,omitempty"`
// RecurringYearly bool `json:"recurring_yearly,omitempty" jsonschema:"if true, reminds every year"`
// ReminderDaysBefore int `json:"reminder_days_before,omitempty" jsonschema:"how many days before to remind (default: 7)"`
// Notes string `json:"notes,omitempty"`
// }
type AddImportantDateOutput struct {
Date ext.ImportantDate `json:"date"`
}
// type AddImportantDateOutput struct {
// Date ext.ImportantDate `json:"date"`
// }
func (t *CalendarTool) AddImportantDate(ctx context.Context, _ *mcp.CallToolRequest, in AddImportantDateInput) (*mcp.CallToolResult, AddImportantDateOutput, error) {
if strings.TrimSpace(in.Title) == "" {
return nil, AddImportantDateOutput{}, errRequiredField("title")
}
reminder := in.ReminderDaysBefore
if reminder <= 0 {
reminder = 7
}
d, err := t.store.AddImportantDate(ctx, ext.ImportantDate{
FamilyMemberID: in.FamilyMemberID,
Title: strings.TrimSpace(in.Title),
DateValue: in.DateValue,
RecurringYearly: in.RecurringYearly,
ReminderDaysBefore: reminder,
Notes: strings.TrimSpace(in.Notes),
})
if err != nil {
return nil, AddImportantDateOutput{}, err
}
return nil, AddImportantDateOutput{Date: d}, nil
}
// func (t *CalendarTool) AddImportantDate(ctx context.Context, _ *mcp.CallToolRequest, in AddImportantDateInput) (*mcp.CallToolResult, AddImportantDateOutput, error) {
// if strings.TrimSpace(in.Title) == "" {
// return nil, AddImportantDateOutput{}, errRequiredField("title")
// }
// reminder := in.ReminderDaysBefore
// if reminder <= 0 {
// reminder = 7
// }
// d, err := t.store.AddImportantDate(ctx, ext.ImportantDate{
// FamilyMemberID: in.FamilyMemberID,
// Title: strings.TrimSpace(in.Title),
// DateValue: in.DateValue,
// RecurringYearly: in.RecurringYearly,
// ReminderDaysBefore: reminder,
// Notes: strings.TrimSpace(in.Notes),
// })
// if err != nil {
// return nil, AddImportantDateOutput{}, err
// }
// return nil, AddImportantDateOutput{Date: d}, nil
// }
// get_upcoming_dates
// // get_upcoming_dates
type GetUpcomingDatesInput struct {
DaysAhead int `json:"days_ahead,omitempty" jsonschema:"how many days to look ahead (default: 30)"`
}
// type GetUpcomingDatesInput struct {
// DaysAhead int `json:"days_ahead,omitempty" jsonschema:"how many days to look ahead (default: 30)"`
// }
type GetUpcomingDatesOutput struct {
Dates []ext.ImportantDate `json:"dates"`
}
// type GetUpcomingDatesOutput struct {
// Dates []ext.ImportantDate `json:"dates"`
// }
func (t *CalendarTool) GetUpcomingDates(ctx context.Context, _ *mcp.CallToolRequest, in GetUpcomingDatesInput) (*mcp.CallToolResult, GetUpcomingDatesOutput, error) {
dates, err := t.store.GetUpcomingDates(ctx, in.DaysAhead)
if err != nil {
return nil, GetUpcomingDatesOutput{}, err
}
if dates == nil {
dates = []ext.ImportantDate{}
}
return nil, GetUpcomingDatesOutput{Dates: dates}, nil
}
// func (t *CalendarTool) GetUpcomingDates(ctx context.Context, _ *mcp.CallToolRequest, in GetUpcomingDatesInput) (*mcp.CallToolResult, GetUpcomingDatesOutput, error) {
// dates, err := t.store.GetUpcomingDates(ctx, in.DaysAhead)
// if err != nil {
// return nil, GetUpcomingDatesOutput{}, err
// }
// if dates == nil {
// dates = []ext.ImportantDate{}
// }
// return nil, GetUpcomingDatesOutput{Dates: dates}, nil
// }

View File

@@ -1,240 +1,240 @@
package tools
import (
"context"
"errors"
"fmt"
"strings"
"time"
// import (
// "context"
// "errors"
// "fmt"
// "strings"
// "time"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/modelcontextprotocol/go-sdk/mcp"
// "github.com/google/uuid"
// "github.com/jackc/pgx/v5"
// "github.com/modelcontextprotocol/go-sdk/mcp"
"git.warky.dev/wdevs/amcs/internal/store"
ext "git.warky.dev/wdevs/amcs/internal/types"
)
// "git.warky.dev/wdevs/amcs/internal/store"
// ext "git.warky.dev/wdevs/amcs/internal/types"
// )
type CRMTool struct {
store *store.DB
}
// type CRMTool struct {
// store *store.DB
// }
func NewCRMTool(db *store.DB) *CRMTool {
return &CRMTool{store: db}
}
// func NewCRMTool(db *store.DB) *CRMTool {
// return &CRMTool{store: db}
// }
// add_professional_contact
// // add_professional_contact
type AddContactInput struct {
Name string `json:"name" jsonschema:"contact's full name"`
Company string `json:"company,omitempty"`
Title string `json:"title,omitempty" jsonschema:"job title"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
LinkedInURL string `json:"linkedin_url,omitempty"`
HowWeMet string `json:"how_we_met,omitempty"`
Tags []string `json:"tags,omitempty"`
Notes string `json:"notes,omitempty"`
FollowUpDate *time.Time `json:"follow_up_date,omitempty"`
}
// type AddContactInput struct {
// Name string `json:"name" jsonschema:"contact's full name"`
// Company string `json:"company,omitempty"`
// Title string `json:"title,omitempty" jsonschema:"job title"`
// Email string `json:"email,omitempty"`
// Phone string `json:"phone,omitempty"`
// LinkedInURL string `json:"linkedin_url,omitempty"`
// HowWeMet string `json:"how_we_met,omitempty"`
// Tags []string `json:"tags,omitempty"`
// Notes string `json:"notes,omitempty"`
// FollowUpDate *time.Time `json:"follow_up_date,omitempty"`
// }
type AddContactOutput struct {
Contact ext.ProfessionalContact `json:"contact"`
}
// type AddContactOutput struct {
// Contact ext.ProfessionalContact `json:"contact"`
// }
func (t *CRMTool) AddContact(ctx context.Context, _ *mcp.CallToolRequest, in AddContactInput) (*mcp.CallToolResult, AddContactOutput, error) {
if strings.TrimSpace(in.Name) == "" {
return nil, AddContactOutput{}, errRequiredField("name")
}
if in.Tags == nil {
in.Tags = []string{}
}
contact, err := t.store.AddProfessionalContact(ctx, ext.ProfessionalContact{
Name: strings.TrimSpace(in.Name),
Company: strings.TrimSpace(in.Company),
Title: strings.TrimSpace(in.Title),
Email: strings.TrimSpace(in.Email),
Phone: strings.TrimSpace(in.Phone),
LinkedInURL: strings.TrimSpace(in.LinkedInURL),
HowWeMet: strings.TrimSpace(in.HowWeMet),
Tags: in.Tags,
Notes: strings.TrimSpace(in.Notes),
FollowUpDate: in.FollowUpDate,
})
if err != nil {
return nil, AddContactOutput{}, err
}
return nil, AddContactOutput{Contact: contact}, nil
}
// func (t *CRMTool) AddContact(ctx context.Context, _ *mcp.CallToolRequest, in AddContactInput) (*mcp.CallToolResult, AddContactOutput, error) {
// if strings.TrimSpace(in.Name) == "" {
// return nil, AddContactOutput{}, errRequiredField("name")
// }
// if in.Tags == nil {
// in.Tags = []string{}
// }
// contact, err := t.store.AddProfessionalContact(ctx, ext.ProfessionalContact{
// Name: strings.TrimSpace(in.Name),
// Company: strings.TrimSpace(in.Company),
// Title: strings.TrimSpace(in.Title),
// Email: strings.TrimSpace(in.Email),
// Phone: strings.TrimSpace(in.Phone),
// LinkedInURL: strings.TrimSpace(in.LinkedInURL),
// HowWeMet: strings.TrimSpace(in.HowWeMet),
// Tags: in.Tags,
// Notes: strings.TrimSpace(in.Notes),
// FollowUpDate: in.FollowUpDate,
// })
// if err != nil {
// return nil, AddContactOutput{}, err
// }
// return nil, AddContactOutput{Contact: contact}, nil
// }
// search_contacts
// // search_contacts
type SearchContactsInput struct {
Query string `json:"query,omitempty" jsonschema:"search text matching name, company, title, or notes"`
Tags []string `json:"tags,omitempty" jsonschema:"filter by tags (all must match)"`
}
// type SearchContactsInput struct {
// Query string `json:"query,omitempty" jsonschema:"search text matching name, company, title, or notes"`
// Tags []string `json:"tags,omitempty" jsonschema:"filter by tags (all must match)"`
// }
type SearchContactsOutput struct {
Contacts []ext.ProfessionalContact `json:"contacts"`
}
// type SearchContactsOutput struct {
// Contacts []ext.ProfessionalContact `json:"contacts"`
// }
func (t *CRMTool) SearchContacts(ctx context.Context, _ *mcp.CallToolRequest, in SearchContactsInput) (*mcp.CallToolResult, SearchContactsOutput, error) {
contacts, err := t.store.SearchContacts(ctx, in.Query, in.Tags)
if err != nil {
return nil, SearchContactsOutput{}, err
}
if contacts == nil {
contacts = []ext.ProfessionalContact{}
}
return nil, SearchContactsOutput{Contacts: contacts}, nil
}
// func (t *CRMTool) SearchContacts(ctx context.Context, _ *mcp.CallToolRequest, in SearchContactsInput) (*mcp.CallToolResult, SearchContactsOutput, error) {
// contacts, err := t.store.SearchContacts(ctx, in.Query, in.Tags)
// if err != nil {
// return nil, SearchContactsOutput{}, err
// }
// if contacts == nil {
// contacts = []ext.ProfessionalContact{}
// }
// return nil, SearchContactsOutput{Contacts: contacts}, nil
// }
// log_interaction
// // log_interaction
type LogInteractionInput struct {
ContactID uuid.UUID `json:"contact_id" jsonschema:"id of the contact"`
InteractionType string `json:"interaction_type" jsonschema:"one of: meeting, email, call, coffee, event, linkedin, other"`
OccurredAt *time.Time `json:"occurred_at,omitempty" jsonschema:"when it happened (defaults to now)"`
Summary string `json:"summary" jsonschema:"summary of the interaction"`
FollowUpNeeded bool `json:"follow_up_needed,omitempty"`
FollowUpNotes string `json:"follow_up_notes,omitempty"`
}
// type LogInteractionInput struct {
// ContactID uuid.UUID `json:"contact_id" jsonschema:"id of the contact"`
// InteractionType string `json:"interaction_type" jsonschema:"one of: meeting, email, call, coffee, event, linkedin, other"`
// OccurredAt *time.Time `json:"occurred_at,omitempty" jsonschema:"when it happened (defaults to now)"`
// Summary string `json:"summary" jsonschema:"summary of the interaction"`
// FollowUpNeeded bool `json:"follow_up_needed,omitempty"`
// FollowUpNotes string `json:"follow_up_notes,omitempty"`
// }
type LogInteractionOutput struct {
Interaction ext.ContactInteraction `json:"interaction"`
}
// type LogInteractionOutput struct {
// Interaction ext.ContactInteraction `json:"interaction"`
// }
func (t *CRMTool) LogInteraction(ctx context.Context, _ *mcp.CallToolRequest, in LogInteractionInput) (*mcp.CallToolResult, LogInteractionOutput, error) {
if strings.TrimSpace(in.Summary) == "" {
return nil, LogInteractionOutput{}, errRequiredField("summary")
}
occurredAt := time.Now()
if in.OccurredAt != nil {
occurredAt = *in.OccurredAt
}
interaction, err := t.store.LogInteraction(ctx, ext.ContactInteraction{
ContactID: in.ContactID,
InteractionType: in.InteractionType,
OccurredAt: occurredAt,
Summary: strings.TrimSpace(in.Summary),
FollowUpNeeded: in.FollowUpNeeded,
FollowUpNotes: strings.TrimSpace(in.FollowUpNotes),
})
if err != nil {
return nil, LogInteractionOutput{}, err
}
return nil, LogInteractionOutput{Interaction: interaction}, nil
}
// func (t *CRMTool) LogInteraction(ctx context.Context, _ *mcp.CallToolRequest, in LogInteractionInput) (*mcp.CallToolResult, LogInteractionOutput, error) {
// if strings.TrimSpace(in.Summary) == "" {
// return nil, LogInteractionOutput{}, errRequiredField("summary")
// }
// occurredAt := time.Now()
// if in.OccurredAt != nil {
// occurredAt = *in.OccurredAt
// }
// interaction, err := t.store.LogInteraction(ctx, ext.ContactInteraction{
// ContactID: in.ContactID,
// InteractionType: in.InteractionType,
// OccurredAt: occurredAt,
// Summary: strings.TrimSpace(in.Summary),
// FollowUpNeeded: in.FollowUpNeeded,
// FollowUpNotes: strings.TrimSpace(in.FollowUpNotes),
// })
// if err != nil {
// return nil, LogInteractionOutput{}, err
// }
// return nil, LogInteractionOutput{Interaction: interaction}, nil
// }
// get_contact_history
// // get_contact_history
type GetContactHistoryInput struct {
ContactID uuid.UUID `json:"contact_id" jsonschema:"id of the contact"`
}
// type GetContactHistoryInput struct {
// ContactID uuid.UUID `json:"contact_id" jsonschema:"id of the contact"`
// }
type GetContactHistoryOutput struct {
History ext.ContactHistory `json:"history"`
}
// type GetContactHistoryOutput struct {
// History ext.ContactHistory `json:"history"`
// }
func (t *CRMTool) GetHistory(ctx context.Context, _ *mcp.CallToolRequest, in GetContactHistoryInput) (*mcp.CallToolResult, GetContactHistoryOutput, error) {
history, err := t.store.GetContactHistory(ctx, in.ContactID)
if err != nil {
return nil, GetContactHistoryOutput{}, err
}
return nil, GetContactHistoryOutput{History: history}, nil
}
// func (t *CRMTool) GetHistory(ctx context.Context, _ *mcp.CallToolRequest, in GetContactHistoryInput) (*mcp.CallToolResult, GetContactHistoryOutput, error) {
// history, err := t.store.GetContactHistory(ctx, in.ContactID)
// if err != nil {
// return nil, GetContactHistoryOutput{}, err
// }
// return nil, GetContactHistoryOutput{History: history}, nil
// }
// create_opportunity
// // create_opportunity
type CreateOpportunityInput struct {
ContactID *uuid.UUID `json:"contact_id,omitempty"`
Title string `json:"title" jsonschema:"opportunity title"`
Description string `json:"description,omitempty"`
Stage string `json:"stage,omitempty" jsonschema:"one of: identified, in_conversation, proposal, negotiation, won, lost (default: identified)"`
Value *float64 `json:"value,omitempty" jsonschema:"monetary value"`
ExpectedCloseDate *time.Time `json:"expected_close_date,omitempty"`
Notes string `json:"notes,omitempty"`
}
// type CreateOpportunityInput struct {
// ContactID *uuid.UUID `json:"contact_id,omitempty"`
// Title string `json:"title" jsonschema:"opportunity title"`
// Description string `json:"description,omitempty"`
// Stage string `json:"stage,omitempty" jsonschema:"one of: identified, in_conversation, proposal, negotiation, won, lost (default: identified)"`
// Value *float64 `json:"value,omitempty" jsonschema:"monetary value"`
// ExpectedCloseDate *time.Time `json:"expected_close_date,omitempty"`
// Notes string `json:"notes,omitempty"`
// }
type CreateOpportunityOutput struct {
Opportunity ext.Opportunity `json:"opportunity"`
}
// type CreateOpportunityOutput struct {
// Opportunity ext.Opportunity `json:"opportunity"`
// }
func (t *CRMTool) CreateOpportunity(ctx context.Context, _ *mcp.CallToolRequest, in CreateOpportunityInput) (*mcp.CallToolResult, CreateOpportunityOutput, error) {
if strings.TrimSpace(in.Title) == "" {
return nil, CreateOpportunityOutput{}, errRequiredField("title")
}
stage := strings.TrimSpace(in.Stage)
if stage == "" {
stage = "identified"
}
opp, err := t.store.CreateOpportunity(ctx, ext.Opportunity{
ContactID: in.ContactID,
Title: strings.TrimSpace(in.Title),
Description: strings.TrimSpace(in.Description),
Stage: stage,
Value: in.Value,
ExpectedCloseDate: in.ExpectedCloseDate,
Notes: strings.TrimSpace(in.Notes),
})
if err != nil {
return nil, CreateOpportunityOutput{}, err
}
return nil, CreateOpportunityOutput{Opportunity: opp}, nil
}
// func (t *CRMTool) CreateOpportunity(ctx context.Context, _ *mcp.CallToolRequest, in CreateOpportunityInput) (*mcp.CallToolResult, CreateOpportunityOutput, error) {
// if strings.TrimSpace(in.Title) == "" {
// return nil, CreateOpportunityOutput{}, errRequiredField("title")
// }
// stage := strings.TrimSpace(in.Stage)
// if stage == "" {
// stage = "identified"
// }
// opp, err := t.store.CreateOpportunity(ctx, ext.Opportunity{
// ContactID: in.ContactID,
// Title: strings.TrimSpace(in.Title),
// Description: strings.TrimSpace(in.Description),
// Stage: stage,
// Value: in.Value,
// ExpectedCloseDate: in.ExpectedCloseDate,
// Notes: strings.TrimSpace(in.Notes),
// })
// if err != nil {
// return nil, CreateOpportunityOutput{}, err
// }
// return nil, CreateOpportunityOutput{Opportunity: opp}, nil
// }
// get_follow_ups_due
// // get_follow_ups_due
type GetFollowUpsDueInput struct {
DaysAhead int `json:"days_ahead,omitempty" jsonschema:"look ahead window in days (default: 7)"`
}
// type GetFollowUpsDueInput struct {
// DaysAhead int `json:"days_ahead,omitempty" jsonschema:"look ahead window in days (default: 7)"`
// }
type GetFollowUpsDueOutput struct {
Contacts []ext.ProfessionalContact `json:"contacts"`
}
// type GetFollowUpsDueOutput struct {
// Contacts []ext.ProfessionalContact `json:"contacts"`
// }
func (t *CRMTool) GetFollowUpsDue(ctx context.Context, _ *mcp.CallToolRequest, in GetFollowUpsDueInput) (*mcp.CallToolResult, GetFollowUpsDueOutput, error) {
contacts, err := t.store.GetFollowUpsDue(ctx, in.DaysAhead)
if err != nil {
return nil, GetFollowUpsDueOutput{}, err
}
if contacts == nil {
contacts = []ext.ProfessionalContact{}
}
return nil, GetFollowUpsDueOutput{Contacts: contacts}, nil
}
// func (t *CRMTool) GetFollowUpsDue(ctx context.Context, _ *mcp.CallToolRequest, in GetFollowUpsDueInput) (*mcp.CallToolResult, GetFollowUpsDueOutput, error) {
// contacts, err := t.store.GetFollowUpsDue(ctx, in.DaysAhead)
// if err != nil {
// return nil, GetFollowUpsDueOutput{}, err
// }
// if contacts == nil {
// contacts = []ext.ProfessionalContact{}
// }
// return nil, GetFollowUpsDueOutput{Contacts: contacts}, nil
// }
// link_thought_to_contact
// // link_thought_to_contact
type LinkThoughtToContactInput struct {
ContactID uuid.UUID `json:"contact_id" jsonschema:"id of the contact"`
ThoughtID uuid.UUID `json:"thought_id" jsonschema:"id of the thought to link"`
}
// type LinkThoughtToContactInput struct {
// ContactID uuid.UUID `json:"contact_id" jsonschema:"id of the contact"`
// ThoughtID uuid.UUID `json:"thought_id" jsonschema:"id of the thought to link"`
// }
type LinkThoughtToContactOutput struct {
Contact ext.ProfessionalContact `json:"contact"`
}
// type LinkThoughtToContactOutput struct {
// Contact ext.ProfessionalContact `json:"contact"`
// }
func (t *CRMTool) LinkThought(ctx context.Context, _ *mcp.CallToolRequest, in LinkThoughtToContactInput) (*mcp.CallToolResult, LinkThoughtToContactOutput, error) {
thought, err := t.store.GetThought(ctx, in.ThoughtID)
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
return nil, LinkThoughtToContactOutput{}, errEntityNotFound("thought", "thought_id", in.ThoughtID.String())
}
return nil, LinkThoughtToContactOutput{}, err
}
// func (t *CRMTool) LinkThought(ctx context.Context, _ *mcp.CallToolRequest, in LinkThoughtToContactInput) (*mcp.CallToolResult, LinkThoughtToContactOutput, error) {
// thought, err := t.store.GetThought(ctx, in.ThoughtID)
// if err != nil {
// if errors.Is(err, pgx.ErrNoRows) {
// return nil, LinkThoughtToContactOutput{}, errEntityNotFound("thought", "thought_id", in.ThoughtID.String())
// }
// return nil, LinkThoughtToContactOutput{}, err
// }
appendText := fmt.Sprintf("\n\n[Linked thought %s]: %s", thought.ID, thought.Content)
if err := t.store.AppendThoughtToContactNotes(ctx, in.ContactID, appendText); err != nil {
return nil, LinkThoughtToContactOutput{}, err
}
// appendText := fmt.Sprintf("\n\n[Linked thought %s]: %s", thought.ID, thought.Content)
// if err := t.store.AppendThoughtToContactNotes(ctx, in.ContactID, appendText); err != nil {
// return nil, LinkThoughtToContactOutput{}, err
// }
contact, err := t.store.GetContact(ctx, in.ContactID)
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
return nil, LinkThoughtToContactOutput{}, errEntityNotFound("contact", "contact_id", in.ContactID.String())
}
return nil, LinkThoughtToContactOutput{}, err
}
return nil, LinkThoughtToContactOutput{Contact: contact}, nil
}
// contact, err := t.store.GetContact(ctx, in.ContactID)
// if err != nil {
// if errors.Is(err, pgx.ErrNoRows) {
// return nil, LinkThoughtToContactOutput{}, errEntityNotFound("contact", "contact_id", in.ContactID.String())
// }
// return nil, LinkThoughtToContactOutput{}, err
// }
// return nil, LinkThoughtToContactOutput{Contact: contact}, nil
// }

View File

@@ -1,151 +1,151 @@
package tools
import (
"context"
"strings"
// import (
// "context"
// "strings"
"github.com/google/uuid"
"github.com/modelcontextprotocol/go-sdk/mcp"
// "github.com/google/uuid"
// "github.com/modelcontextprotocol/go-sdk/mcp"
"git.warky.dev/wdevs/amcs/internal/store"
ext "git.warky.dev/wdevs/amcs/internal/types"
)
// "git.warky.dev/wdevs/amcs/internal/store"
// ext "git.warky.dev/wdevs/amcs/internal/types"
// )
type HouseholdTool struct {
store *store.DB
}
// type HouseholdTool struct {
// store *store.DB
// }
func NewHouseholdTool(db *store.DB) *HouseholdTool {
return &HouseholdTool{store: db}
}
// func NewHouseholdTool(db *store.DB) *HouseholdTool {
// return &HouseholdTool{store: db}
// }
// add_household_item
// // add_household_item
type AddHouseholdItemInput struct {
Name string `json:"name" jsonschema:"name of the item"`
Category string `json:"category,omitempty" jsonschema:"category (e.g. paint, appliance, measurement, document)"`
Location string `json:"location,omitempty" jsonschema:"where in the home this item is"`
Details map[string]any `json:"details,omitempty" jsonschema:"flexible metadata (model numbers, colors, specs, etc.)"`
Notes string `json:"notes,omitempty"`
}
// type AddHouseholdItemInput struct {
// Name string `json:"name" jsonschema:"name of the item"`
// Category string `json:"category,omitempty" jsonschema:"category (e.g. paint, appliance, measurement, document)"`
// Location string `json:"location,omitempty" jsonschema:"where in the home this item is"`
// Details map[string]any `json:"details,omitempty" jsonschema:"flexible metadata (model numbers, colors, specs, etc.)"`
// Notes string `json:"notes,omitempty"`
// }
type AddHouseholdItemOutput struct {
Item ext.HouseholdItem `json:"item"`
}
// type AddHouseholdItemOutput struct {
// Item ext.HouseholdItem `json:"item"`
// }
func (t *HouseholdTool) AddItem(ctx context.Context, _ *mcp.CallToolRequest, in AddHouseholdItemInput) (*mcp.CallToolResult, AddHouseholdItemOutput, error) {
if strings.TrimSpace(in.Name) == "" {
return nil, AddHouseholdItemOutput{}, errRequiredField("name")
}
if in.Details == nil {
in.Details = map[string]any{}
}
item, err := t.store.AddHouseholdItem(ctx, ext.HouseholdItem{
Name: strings.TrimSpace(in.Name),
Category: strings.TrimSpace(in.Category),
Location: strings.TrimSpace(in.Location),
Details: in.Details,
Notes: strings.TrimSpace(in.Notes),
})
if err != nil {
return nil, AddHouseholdItemOutput{}, err
}
return nil, AddHouseholdItemOutput{Item: item}, nil
}
// func (t *HouseholdTool) AddItem(ctx context.Context, _ *mcp.CallToolRequest, in AddHouseholdItemInput) (*mcp.CallToolResult, AddHouseholdItemOutput, error) {
// if strings.TrimSpace(in.Name) == "" {
// return nil, AddHouseholdItemOutput{}, errRequiredField("name")
// }
// if in.Details == nil {
// in.Details = map[string]any{}
// }
// item, err := t.store.AddHouseholdItem(ctx, ext.HouseholdItem{
// Name: strings.TrimSpace(in.Name),
// Category: strings.TrimSpace(in.Category),
// Location: strings.TrimSpace(in.Location),
// Details: in.Details,
// Notes: strings.TrimSpace(in.Notes),
// })
// if err != nil {
// return nil, AddHouseholdItemOutput{}, err
// }
// return nil, AddHouseholdItemOutput{Item: item}, nil
// }
// search_household_items
// // search_household_items
type SearchHouseholdItemsInput struct {
Query string `json:"query,omitempty" jsonschema:"search text matching name or notes"`
Category string `json:"category,omitempty" jsonschema:"filter by category"`
Location string `json:"location,omitempty" jsonschema:"filter by location"`
}
// type SearchHouseholdItemsInput struct {
// Query string `json:"query,omitempty" jsonschema:"search text matching name or notes"`
// Category string `json:"category,omitempty" jsonschema:"filter by category"`
// Location string `json:"location,omitempty" jsonschema:"filter by location"`
// }
type SearchHouseholdItemsOutput struct {
Items []ext.HouseholdItem `json:"items"`
}
// type SearchHouseholdItemsOutput struct {
// Items []ext.HouseholdItem `json:"items"`
// }
func (t *HouseholdTool) SearchItems(ctx context.Context, _ *mcp.CallToolRequest, in SearchHouseholdItemsInput) (*mcp.CallToolResult, SearchHouseholdItemsOutput, error) {
items, err := t.store.SearchHouseholdItems(ctx, in.Query, in.Category, in.Location)
if err != nil {
return nil, SearchHouseholdItemsOutput{}, err
}
if items == nil {
items = []ext.HouseholdItem{}
}
return nil, SearchHouseholdItemsOutput{Items: items}, nil
}
// func (t *HouseholdTool) SearchItems(ctx context.Context, _ *mcp.CallToolRequest, in SearchHouseholdItemsInput) (*mcp.CallToolResult, SearchHouseholdItemsOutput, error) {
// items, err := t.store.SearchHouseholdItems(ctx, in.Query, in.Category, in.Location)
// if err != nil {
// return nil, SearchHouseholdItemsOutput{}, err
// }
// if items == nil {
// items = []ext.HouseholdItem{}
// }
// return nil, SearchHouseholdItemsOutput{Items: items}, nil
// }
// get_household_item
// // get_household_item
type GetHouseholdItemInput struct {
ID uuid.UUID `json:"id" jsonschema:"item id"`
}
// type GetHouseholdItemInput struct {
// ID uuid.UUID `json:"id" jsonschema:"item id"`
// }
type GetHouseholdItemOutput struct {
Item ext.HouseholdItem `json:"item"`
}
// type GetHouseholdItemOutput struct {
// Item ext.HouseholdItem `json:"item"`
// }
func (t *HouseholdTool) GetItem(ctx context.Context, _ *mcp.CallToolRequest, in GetHouseholdItemInput) (*mcp.CallToolResult, GetHouseholdItemOutput, error) {
item, err := t.store.GetHouseholdItem(ctx, in.ID)
if err != nil {
return nil, GetHouseholdItemOutput{}, err
}
return nil, GetHouseholdItemOutput{Item: item}, nil
}
// func (t *HouseholdTool) GetItem(ctx context.Context, _ *mcp.CallToolRequest, in GetHouseholdItemInput) (*mcp.CallToolResult, GetHouseholdItemOutput, error) {
// item, err := t.store.GetHouseholdItem(ctx, in.ID)
// if err != nil {
// return nil, GetHouseholdItemOutput{}, err
// }
// return nil, GetHouseholdItemOutput{Item: item}, nil
// }
// add_vendor
// // add_vendor
type AddVendorInput struct {
Name string `json:"name" jsonschema:"vendor name"`
ServiceType string `json:"service_type,omitempty" jsonschema:"type of service (e.g. plumber, electrician, landscaper)"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
Website string `json:"website,omitempty"`
Notes string `json:"notes,omitempty"`
Rating *int `json:"rating,omitempty" jsonschema:"1-5 rating"`
}
// type AddVendorInput struct {
// Name string `json:"name" jsonschema:"vendor name"`
// ServiceType string `json:"service_type,omitempty" jsonschema:"type of service (e.g. plumber, electrician, landscaper)"`
// Phone string `json:"phone,omitempty"`
// Email string `json:"email,omitempty"`
// Website string `json:"website,omitempty"`
// Notes string `json:"notes,omitempty"`
// Rating *int `json:"rating,omitempty" jsonschema:"1-5 rating"`
// }
type AddVendorOutput struct {
Vendor ext.HouseholdVendor `json:"vendor"`
}
// type AddVendorOutput struct {
// Vendor ext.HouseholdVendor `json:"vendor"`
// }
func (t *HouseholdTool) AddVendor(ctx context.Context, _ *mcp.CallToolRequest, in AddVendorInput) (*mcp.CallToolResult, AddVendorOutput, error) {
if strings.TrimSpace(in.Name) == "" {
return nil, AddVendorOutput{}, errRequiredField("name")
}
vendor, err := t.store.AddVendor(ctx, ext.HouseholdVendor{
Name: strings.TrimSpace(in.Name),
ServiceType: strings.TrimSpace(in.ServiceType),
Phone: strings.TrimSpace(in.Phone),
Email: strings.TrimSpace(in.Email),
Website: strings.TrimSpace(in.Website),
Notes: strings.TrimSpace(in.Notes),
Rating: in.Rating,
})
if err != nil {
return nil, AddVendorOutput{}, err
}
return nil, AddVendorOutput{Vendor: vendor}, nil
}
// func (t *HouseholdTool) AddVendor(ctx context.Context, _ *mcp.CallToolRequest, in AddVendorInput) (*mcp.CallToolResult, AddVendorOutput, error) {
// if strings.TrimSpace(in.Name) == "" {
// return nil, AddVendorOutput{}, errRequiredField("name")
// }
// vendor, err := t.store.AddVendor(ctx, ext.HouseholdVendor{
// Name: strings.TrimSpace(in.Name),
// ServiceType: strings.TrimSpace(in.ServiceType),
// Phone: strings.TrimSpace(in.Phone),
// Email: strings.TrimSpace(in.Email),
// Website: strings.TrimSpace(in.Website),
// Notes: strings.TrimSpace(in.Notes),
// Rating: in.Rating,
// })
// if err != nil {
// return nil, AddVendorOutput{}, err
// }
// return nil, AddVendorOutput{Vendor: vendor}, nil
// }
// list_vendors
// // list_vendors
type ListVendorsInput struct {
ServiceType string `json:"service_type,omitempty" jsonschema:"filter by service type"`
}
// type ListVendorsInput struct {
// ServiceType string `json:"service_type,omitempty" jsonschema:"filter by service type"`
// }
type ListVendorsOutput struct {
Vendors []ext.HouseholdVendor `json:"vendors"`
}
// type ListVendorsOutput struct {
// Vendors []ext.HouseholdVendor `json:"vendors"`
// }
func (t *HouseholdTool) ListVendors(ctx context.Context, _ *mcp.CallToolRequest, in ListVendorsInput) (*mcp.CallToolResult, ListVendorsOutput, error) {
vendors, err := t.store.ListVendors(ctx, in.ServiceType)
if err != nil {
return nil, ListVendorsOutput{}, err
}
if vendors == nil {
vendors = []ext.HouseholdVendor{}
}
return nil, ListVendorsOutput{Vendors: vendors}, nil
}
// func (t *HouseholdTool) ListVendors(ctx context.Context, _ *mcp.CallToolRequest, in ListVendorsInput) (*mcp.CallToolResult, ListVendorsOutput, error) {
// vendors, err := t.store.ListVendors(ctx, in.ServiceType)
// if err != nil {
// return nil, ListVendorsOutput{}, err
// }
// if vendors == nil {
// vendors = []ext.HouseholdVendor{}
// }
// return nil, ListVendorsOutput{Vendors: vendors}, nil
// }

View File

@@ -1,137 +1,137 @@
package tools
import (
"context"
"strings"
"time"
// import (
// "context"
// "strings"
// "time"
"github.com/google/uuid"
"github.com/modelcontextprotocol/go-sdk/mcp"
// "github.com/google/uuid"
// "github.com/modelcontextprotocol/go-sdk/mcp"
"git.warky.dev/wdevs/amcs/internal/store"
ext "git.warky.dev/wdevs/amcs/internal/types"
)
// "git.warky.dev/wdevs/amcs/internal/store"
// ext "git.warky.dev/wdevs/amcs/internal/types"
// )
type MaintenanceTool struct {
store *store.DB
}
// type MaintenanceTool struct {
// store *store.DB
// }
func NewMaintenanceTool(db *store.DB) *MaintenanceTool {
return &MaintenanceTool{store: db}
}
// func NewMaintenanceTool(db *store.DB) *MaintenanceTool {
// return &MaintenanceTool{store: db}
// }
// add_maintenance_task
// // add_maintenance_task
type AddMaintenanceTaskInput struct {
Name string `json:"name" jsonschema:"task name"`
Category string `json:"category,omitempty" jsonschema:"e.g. hvac, plumbing, exterior, appliance, landscaping"`
FrequencyDays *int `json:"frequency_days,omitempty" jsonschema:"recurrence interval in days; omit for one-time tasks"`
NextDue *time.Time `json:"next_due,omitempty" jsonschema:"when the task is next due"`
Priority string `json:"priority,omitempty" jsonschema:"low, medium, high, or urgent (default: medium)"`
Notes string `json:"notes,omitempty"`
}
// type AddMaintenanceTaskInput struct {
// Name string `json:"name" jsonschema:"task name"`
// Category string `json:"category,omitempty" jsonschema:"e.g. hvac, plumbing, exterior, appliance, landscaping"`
// FrequencyDays *int `json:"frequency_days,omitempty" jsonschema:"recurrence interval in days; omit for one-time tasks"`
// NextDue *time.Time `json:"next_due,omitempty" jsonschema:"when the task is next due"`
// Priority string `json:"priority,omitempty" jsonschema:"low, medium, high, or urgent (default: medium)"`
// Notes string `json:"notes,omitempty"`
// }
type AddMaintenanceTaskOutput struct {
Task ext.MaintenanceTask `json:"task"`
}
// type AddMaintenanceTaskOutput struct {
// Task ext.MaintenanceTask `json:"task"`
// }
func (t *MaintenanceTool) AddTask(ctx context.Context, _ *mcp.CallToolRequest, in AddMaintenanceTaskInput) (*mcp.CallToolResult, AddMaintenanceTaskOutput, error) {
if strings.TrimSpace(in.Name) == "" {
return nil, AddMaintenanceTaskOutput{}, errRequiredField("name")
}
priority := strings.TrimSpace(in.Priority)
if priority == "" {
priority = "medium"
}
task, err := t.store.AddMaintenanceTask(ctx, ext.MaintenanceTask{
Name: strings.TrimSpace(in.Name),
Category: strings.TrimSpace(in.Category),
FrequencyDays: in.FrequencyDays,
NextDue: in.NextDue,
Priority: priority,
Notes: strings.TrimSpace(in.Notes),
})
if err != nil {
return nil, AddMaintenanceTaskOutput{}, err
}
return nil, AddMaintenanceTaskOutput{Task: task}, nil
}
// func (t *MaintenanceTool) AddTask(ctx context.Context, _ *mcp.CallToolRequest, in AddMaintenanceTaskInput) (*mcp.CallToolResult, AddMaintenanceTaskOutput, error) {
// if strings.TrimSpace(in.Name) == "" {
// return nil, AddMaintenanceTaskOutput{}, errRequiredField("name")
// }
// priority := strings.TrimSpace(in.Priority)
// if priority == "" {
// priority = "medium"
// }
// task, err := t.store.AddMaintenanceTask(ctx, ext.MaintenanceTask{
// Name: strings.TrimSpace(in.Name),
// Category: strings.TrimSpace(in.Category),
// FrequencyDays: in.FrequencyDays,
// NextDue: in.NextDue,
// Priority: priority,
// Notes: strings.TrimSpace(in.Notes),
// })
// if err != nil {
// return nil, AddMaintenanceTaskOutput{}, err
// }
// return nil, AddMaintenanceTaskOutput{Task: task}, nil
// }
// log_maintenance
// // log_maintenance
type LogMaintenanceInput struct {
TaskID uuid.UUID `json:"task_id" jsonschema:"id of the maintenance task"`
CompletedAt *time.Time `json:"completed_at,omitempty" jsonschema:"when the work was done (defaults to now)"`
PerformedBy string `json:"performed_by,omitempty" jsonschema:"who did the work (self, vendor name, etc.)"`
Cost *float64 `json:"cost,omitempty" jsonschema:"cost of the work"`
Notes string `json:"notes,omitempty"`
NextAction string `json:"next_action,omitempty" jsonschema:"recommended follow-up"`
}
// type LogMaintenanceInput struct {
// TaskID uuid.UUID `json:"task_id" jsonschema:"id of the maintenance task"`
// CompletedAt *time.Time `json:"completed_at,omitempty" jsonschema:"when the work was done (defaults to now)"`
// PerformedBy string `json:"performed_by,omitempty" jsonschema:"who did the work (self, vendor name, etc.)"`
// Cost *float64 `json:"cost,omitempty" jsonschema:"cost of the work"`
// Notes string `json:"notes,omitempty"`
// NextAction string `json:"next_action,omitempty" jsonschema:"recommended follow-up"`
// }
type LogMaintenanceOutput struct {
Log ext.MaintenanceLog `json:"log"`
}
// type LogMaintenanceOutput struct {
// Log ext.MaintenanceLog `json:"log"`
// }
func (t *MaintenanceTool) LogWork(ctx context.Context, _ *mcp.CallToolRequest, in LogMaintenanceInput) (*mcp.CallToolResult, LogMaintenanceOutput, error) {
completedAt := time.Now()
if in.CompletedAt != nil {
completedAt = *in.CompletedAt
}
log, err := t.store.LogMaintenance(ctx, ext.MaintenanceLog{
TaskID: in.TaskID,
CompletedAt: completedAt,
PerformedBy: strings.TrimSpace(in.PerformedBy),
Cost: in.Cost,
Notes: strings.TrimSpace(in.Notes),
NextAction: strings.TrimSpace(in.NextAction),
})
if err != nil {
return nil, LogMaintenanceOutput{}, err
}
return nil, LogMaintenanceOutput{Log: log}, nil
}
// func (t *MaintenanceTool) LogWork(ctx context.Context, _ *mcp.CallToolRequest, in LogMaintenanceInput) (*mcp.CallToolResult, LogMaintenanceOutput, error) {
// completedAt := time.Now()
// if in.CompletedAt != nil {
// completedAt = *in.CompletedAt
// }
// log, err := t.store.LogMaintenance(ctx, ext.MaintenanceLog{
// TaskID: in.TaskID,
// CompletedAt: completedAt,
// PerformedBy: strings.TrimSpace(in.PerformedBy),
// Cost: in.Cost,
// Notes: strings.TrimSpace(in.Notes),
// NextAction: strings.TrimSpace(in.NextAction),
// })
// if err != nil {
// return nil, LogMaintenanceOutput{}, err
// }
// return nil, LogMaintenanceOutput{Log: log}, nil
// }
// get_upcoming_maintenance
// // get_upcoming_maintenance
type GetUpcomingMaintenanceInput struct {
DaysAhead int `json:"days_ahead,omitempty" jsonschema:"how many days to look ahead (default: 30)"`
}
// type GetUpcomingMaintenanceInput struct {
// DaysAhead int `json:"days_ahead,omitempty" jsonschema:"how many days to look ahead (default: 30)"`
// }
type GetUpcomingMaintenanceOutput struct {
Tasks []ext.MaintenanceTask `json:"tasks"`
}
// type GetUpcomingMaintenanceOutput struct {
// Tasks []ext.MaintenanceTask `json:"tasks"`
// }
func (t *MaintenanceTool) GetUpcoming(ctx context.Context, _ *mcp.CallToolRequest, in GetUpcomingMaintenanceInput) (*mcp.CallToolResult, GetUpcomingMaintenanceOutput, error) {
tasks, err := t.store.GetUpcomingMaintenance(ctx, in.DaysAhead)
if err != nil {
return nil, GetUpcomingMaintenanceOutput{}, err
}
if tasks == nil {
tasks = []ext.MaintenanceTask{}
}
return nil, GetUpcomingMaintenanceOutput{Tasks: tasks}, nil
}
// func (t *MaintenanceTool) GetUpcoming(ctx context.Context, _ *mcp.CallToolRequest, in GetUpcomingMaintenanceInput) (*mcp.CallToolResult, GetUpcomingMaintenanceOutput, error) {
// tasks, err := t.store.GetUpcomingMaintenance(ctx, in.DaysAhead)
// if err != nil {
// return nil, GetUpcomingMaintenanceOutput{}, err
// }
// if tasks == nil {
// tasks = []ext.MaintenanceTask{}
// }
// return nil, GetUpcomingMaintenanceOutput{Tasks: tasks}, nil
// }
// search_maintenance_history
// // search_maintenance_history
type SearchMaintenanceHistoryInput struct {
Query string `json:"query,omitempty" jsonschema:"search text matching task name or notes"`
Category string `json:"category,omitempty" jsonschema:"filter by task category"`
Start *time.Time `json:"start,omitempty" jsonschema:"filter logs completed on or after this date"`
End *time.Time `json:"end,omitempty" jsonschema:"filter logs completed on or before this date"`
}
// type SearchMaintenanceHistoryInput struct {
// Query string `json:"query,omitempty" jsonschema:"search text matching task name or notes"`
// Category string `json:"category,omitempty" jsonschema:"filter by task category"`
// Start *time.Time `json:"start,omitempty" jsonschema:"filter logs completed on or after this date"`
// End *time.Time `json:"end,omitempty" jsonschema:"filter logs completed on or before this date"`
// }
type SearchMaintenanceHistoryOutput struct {
Logs []ext.MaintenanceLogWithTask `json:"logs"`
}
// type SearchMaintenanceHistoryOutput struct {
// Logs []ext.MaintenanceLogWithTask `json:"logs"`
// }
func (t *MaintenanceTool) SearchHistory(ctx context.Context, _ *mcp.CallToolRequest, in SearchMaintenanceHistoryInput) (*mcp.CallToolResult, SearchMaintenanceHistoryOutput, error) {
logs, err := t.store.SearchMaintenanceHistory(ctx, in.Query, in.Category, in.Start, in.End)
if err != nil {
return nil, SearchMaintenanceHistoryOutput{}, err
}
if logs == nil {
logs = []ext.MaintenanceLogWithTask{}
}
return nil, SearchMaintenanceHistoryOutput{Logs: logs}, nil
}
// func (t *MaintenanceTool) SearchHistory(ctx context.Context, _ *mcp.CallToolRequest, in SearchMaintenanceHistoryInput) (*mcp.CallToolResult, SearchMaintenanceHistoryOutput, error) {
// logs, err := t.store.SearchMaintenanceHistory(ctx, in.Query, in.Category, in.Start, in.End)
// if err != nil {
// return nil, SearchMaintenanceHistoryOutput{}, err
// }
// if logs == nil {
// logs = []ext.MaintenanceLogWithTask{}
// }
// return nil, SearchMaintenanceHistoryOutput{Logs: logs}, nil
// }

View File

@@ -1,210 +1,210 @@
package tools
import (
"context"
"strings"
"time"
// import (
// "context"
// "strings"
// "time"
"github.com/google/uuid"
"github.com/modelcontextprotocol/go-sdk/mcp"
// "github.com/google/uuid"
// "github.com/modelcontextprotocol/go-sdk/mcp"
"git.warky.dev/wdevs/amcs/internal/store"
ext "git.warky.dev/wdevs/amcs/internal/types"
)
// "git.warky.dev/wdevs/amcs/internal/store"
// ext "git.warky.dev/wdevs/amcs/internal/types"
// )
type MealsTool struct {
store *store.DB
}
// type MealsTool struct {
// store *store.DB
// }
func NewMealsTool(db *store.DB) *MealsTool {
return &MealsTool{store: db}
}
// func NewMealsTool(db *store.DB) *MealsTool {
// return &MealsTool{store: db}
// }
// add_recipe
// // add_recipe
type AddRecipeInput struct {
Name string `json:"name" jsonschema:"recipe name"`
Cuisine string `json:"cuisine,omitempty"`
PrepTimeMinutes *int `json:"prep_time_minutes,omitempty"`
CookTimeMinutes *int `json:"cook_time_minutes,omitempty"`
Servings *int `json:"servings,omitempty"`
Ingredients []ext.Ingredient `json:"ingredients,omitempty" jsonschema:"list of ingredients with name, quantity, unit"`
Instructions []string `json:"instructions,omitempty" jsonschema:"ordered list of steps"`
Tags []string `json:"tags,omitempty"`
Rating *int `json:"rating,omitempty" jsonschema:"1-5 rating"`
Notes string `json:"notes,omitempty"`
}
// type AddRecipeInput struct {
// Name string `json:"name" jsonschema:"recipe name"`
// Cuisine string `json:"cuisine,omitempty"`
// PrepTimeMinutes *int `json:"prep_time_minutes,omitempty"`
// CookTimeMinutes *int `json:"cook_time_minutes,omitempty"`
// Servings *int `json:"servings,omitempty"`
// Ingredients []ext.Ingredient `json:"ingredients,omitempty" jsonschema:"list of ingredients with name, quantity, unit"`
// Instructions []string `json:"instructions,omitempty" jsonschema:"ordered list of steps"`
// Tags []string `json:"tags,omitempty"`
// Rating *int `json:"rating,omitempty" jsonschema:"1-5 rating"`
// Notes string `json:"notes,omitempty"`
// }
type AddRecipeOutput struct {
Recipe ext.Recipe `json:"recipe"`
}
// type AddRecipeOutput struct {
// Recipe ext.Recipe `json:"recipe"`
// }
func (t *MealsTool) AddRecipe(ctx context.Context, _ *mcp.CallToolRequest, in AddRecipeInput) (*mcp.CallToolResult, AddRecipeOutput, error) {
if strings.TrimSpace(in.Name) == "" {
return nil, AddRecipeOutput{}, errRequiredField("name")
}
if in.Ingredients == nil {
in.Ingredients = []ext.Ingredient{}
}
if in.Instructions == nil {
in.Instructions = []string{}
}
if in.Tags == nil {
in.Tags = []string{}
}
recipe, err := t.store.AddRecipe(ctx, ext.Recipe{
Name: strings.TrimSpace(in.Name),
Cuisine: strings.TrimSpace(in.Cuisine),
PrepTimeMinutes: in.PrepTimeMinutes,
CookTimeMinutes: in.CookTimeMinutes,
Servings: in.Servings,
Ingredients: in.Ingredients,
Instructions: in.Instructions,
Tags: in.Tags,
Rating: in.Rating,
Notes: strings.TrimSpace(in.Notes),
})
if err != nil {
return nil, AddRecipeOutput{}, err
}
return nil, AddRecipeOutput{Recipe: recipe}, nil
}
// func (t *MealsTool) AddRecipe(ctx context.Context, _ *mcp.CallToolRequest, in AddRecipeInput) (*mcp.CallToolResult, AddRecipeOutput, error) {
// if strings.TrimSpace(in.Name) == "" {
// return nil, AddRecipeOutput{}, errRequiredField("name")
// }
// if in.Ingredients == nil {
// in.Ingredients = []ext.Ingredient{}
// }
// if in.Instructions == nil {
// in.Instructions = []string{}
// }
// if in.Tags == nil {
// in.Tags = []string{}
// }
// recipe, err := t.store.AddRecipe(ctx, ext.Recipe{
// Name: strings.TrimSpace(in.Name),
// Cuisine: strings.TrimSpace(in.Cuisine),
// PrepTimeMinutes: in.PrepTimeMinutes,
// CookTimeMinutes: in.CookTimeMinutes,
// Servings: in.Servings,
// Ingredients: in.Ingredients,
// Instructions: in.Instructions,
// Tags: in.Tags,
// Rating: in.Rating,
// Notes: strings.TrimSpace(in.Notes),
// })
// if err != nil {
// return nil, AddRecipeOutput{}, err
// }
// return nil, AddRecipeOutput{Recipe: recipe}, nil
// }
// search_recipes
// // search_recipes
type SearchRecipesInput struct {
Query string `json:"query,omitempty" jsonschema:"search by recipe name"`
Cuisine string `json:"cuisine,omitempty"`
Tags []string `json:"tags,omitempty" jsonschema:"filter by tags (all must match)"`
Ingredient string `json:"ingredient,omitempty" jsonschema:"filter by ingredient name"`
}
// type SearchRecipesInput struct {
// Query string `json:"query,omitempty" jsonschema:"search by recipe name"`
// Cuisine string `json:"cuisine,omitempty"`
// Tags []string `json:"tags,omitempty" jsonschema:"filter by tags (all must match)"`
// Ingredient string `json:"ingredient,omitempty" jsonschema:"filter by ingredient name"`
// }
type SearchRecipesOutput struct {
Recipes []ext.Recipe `json:"recipes"`
}
// type SearchRecipesOutput struct {
// Recipes []ext.Recipe `json:"recipes"`
// }
func (t *MealsTool) SearchRecipes(ctx context.Context, _ *mcp.CallToolRequest, in SearchRecipesInput) (*mcp.CallToolResult, SearchRecipesOutput, error) {
recipes, err := t.store.SearchRecipes(ctx, in.Query, in.Cuisine, in.Tags, in.Ingredient)
if err != nil {
return nil, SearchRecipesOutput{}, err
}
if recipes == nil {
recipes = []ext.Recipe{}
}
return nil, SearchRecipesOutput{Recipes: recipes}, nil
}
// func (t *MealsTool) SearchRecipes(ctx context.Context, _ *mcp.CallToolRequest, in SearchRecipesInput) (*mcp.CallToolResult, SearchRecipesOutput, error) {
// recipes, err := t.store.SearchRecipes(ctx, in.Query, in.Cuisine, in.Tags, in.Ingredient)
// if err != nil {
// return nil, SearchRecipesOutput{}, err
// }
// if recipes == nil {
// recipes = []ext.Recipe{}
// }
// return nil, SearchRecipesOutput{Recipes: recipes}, nil
// }
// update_recipe
// // update_recipe
type UpdateRecipeInput struct {
ID uuid.UUID `json:"id" jsonschema:"recipe id to update"`
Name string `json:"name" jsonschema:"recipe name"`
Cuisine string `json:"cuisine,omitempty"`
PrepTimeMinutes *int `json:"prep_time_minutes,omitempty"`
CookTimeMinutes *int `json:"cook_time_minutes,omitempty"`
Servings *int `json:"servings,omitempty"`
Ingredients []ext.Ingredient `json:"ingredients,omitempty"`
Instructions []string `json:"instructions,omitempty"`
Tags []string `json:"tags,omitempty"`
Rating *int `json:"rating,omitempty"`
Notes string `json:"notes,omitempty"`
}
// type UpdateRecipeInput struct {
// ID uuid.UUID `json:"id" jsonschema:"recipe id to update"`
// Name string `json:"name" jsonschema:"recipe name"`
// Cuisine string `json:"cuisine,omitempty"`
// PrepTimeMinutes *int `json:"prep_time_minutes,omitempty"`
// CookTimeMinutes *int `json:"cook_time_minutes,omitempty"`
// Servings *int `json:"servings,omitempty"`
// Ingredients []ext.Ingredient `json:"ingredients,omitempty"`
// Instructions []string `json:"instructions,omitempty"`
// Tags []string `json:"tags,omitempty"`
// Rating *int `json:"rating,omitempty"`
// Notes string `json:"notes,omitempty"`
// }
type UpdateRecipeOutput struct {
Recipe ext.Recipe `json:"recipe"`
}
// type UpdateRecipeOutput struct {
// Recipe ext.Recipe `json:"recipe"`
// }
func (t *MealsTool) UpdateRecipe(ctx context.Context, _ *mcp.CallToolRequest, in UpdateRecipeInput) (*mcp.CallToolResult, UpdateRecipeOutput, error) {
if strings.TrimSpace(in.Name) == "" {
return nil, UpdateRecipeOutput{}, errRequiredField("name")
}
if in.Ingredients == nil {
in.Ingredients = []ext.Ingredient{}
}
if in.Instructions == nil {
in.Instructions = []string{}
}
if in.Tags == nil {
in.Tags = []string{}
}
recipe, err := t.store.UpdateRecipe(ctx, in.ID, ext.Recipe{
Name: strings.TrimSpace(in.Name),
Cuisine: strings.TrimSpace(in.Cuisine),
PrepTimeMinutes: in.PrepTimeMinutes,
CookTimeMinutes: in.CookTimeMinutes,
Servings: in.Servings,
Ingredients: in.Ingredients,
Instructions: in.Instructions,
Tags: in.Tags,
Rating: in.Rating,
Notes: strings.TrimSpace(in.Notes),
})
if err != nil {
return nil, UpdateRecipeOutput{}, err
}
return nil, UpdateRecipeOutput{Recipe: recipe}, nil
}
// func (t *MealsTool) UpdateRecipe(ctx context.Context, _ *mcp.CallToolRequest, in UpdateRecipeInput) (*mcp.CallToolResult, UpdateRecipeOutput, error) {
// if strings.TrimSpace(in.Name) == "" {
// return nil, UpdateRecipeOutput{}, errRequiredField("name")
// }
// if in.Ingredients == nil {
// in.Ingredients = []ext.Ingredient{}
// }
// if in.Instructions == nil {
// in.Instructions = []string{}
// }
// if in.Tags == nil {
// in.Tags = []string{}
// }
// recipe, err := t.store.UpdateRecipe(ctx, in.ID, ext.Recipe{
// Name: strings.TrimSpace(in.Name),
// Cuisine: strings.TrimSpace(in.Cuisine),
// PrepTimeMinutes: in.PrepTimeMinutes,
// CookTimeMinutes: in.CookTimeMinutes,
// Servings: in.Servings,
// Ingredients: in.Ingredients,
// Instructions: in.Instructions,
// Tags: in.Tags,
// Rating: in.Rating,
// Notes: strings.TrimSpace(in.Notes),
// })
// if err != nil {
// return nil, UpdateRecipeOutput{}, err
// }
// return nil, UpdateRecipeOutput{Recipe: recipe}, nil
// }
// create_meal_plan
// // create_meal_plan
type CreateMealPlanInput struct {
WeekStart time.Time `json:"week_start" jsonschema:"Monday of the week to plan"`
Meals []ext.MealPlanInput `json:"meals" jsonschema:"list of meal entries for the week"`
}
// type CreateMealPlanInput struct {
// WeekStart time.Time `json:"week_start" jsonschema:"Monday of the week to plan"`
// Meals []ext.MealPlanInput `json:"meals" jsonschema:"list of meal entries for the week"`
// }
type CreateMealPlanOutput struct {
Entries []ext.MealPlanEntry `json:"entries"`
}
// type CreateMealPlanOutput struct {
// Entries []ext.MealPlanEntry `json:"entries"`
// }
func (t *MealsTool) CreateMealPlan(ctx context.Context, _ *mcp.CallToolRequest, in CreateMealPlanInput) (*mcp.CallToolResult, CreateMealPlanOutput, error) {
if len(in.Meals) == 0 {
return nil, CreateMealPlanOutput{}, errInvalidInput("meals are required")
}
entries, err := t.store.CreateMealPlan(ctx, in.WeekStart, in.Meals)
if err != nil {
return nil, CreateMealPlanOutput{}, err
}
if entries == nil {
entries = []ext.MealPlanEntry{}
}
return nil, CreateMealPlanOutput{Entries: entries}, nil
}
// func (t *MealsTool) CreateMealPlan(ctx context.Context, _ *mcp.CallToolRequest, in CreateMealPlanInput) (*mcp.CallToolResult, CreateMealPlanOutput, error) {
// if len(in.Meals) == 0 {
// return nil, CreateMealPlanOutput{}, errInvalidInput("meals are required")
// }
// entries, err := t.store.CreateMealPlan(ctx, in.WeekStart, in.Meals)
// if err != nil {
// return nil, CreateMealPlanOutput{}, err
// }
// if entries == nil {
// entries = []ext.MealPlanEntry{}
// }
// return nil, CreateMealPlanOutput{Entries: entries}, nil
// }
// get_meal_plan
// // get_meal_plan
type GetMealPlanInput struct {
WeekStart time.Time `json:"week_start" jsonschema:"Monday of the week to retrieve"`
}
// type GetMealPlanInput struct {
// WeekStart time.Time `json:"week_start" jsonschema:"Monday of the week to retrieve"`
// }
type GetMealPlanOutput struct {
Entries []ext.MealPlanEntry `json:"entries"`
}
// type GetMealPlanOutput struct {
// Entries []ext.MealPlanEntry `json:"entries"`
// }
func (t *MealsTool) GetMealPlan(ctx context.Context, _ *mcp.CallToolRequest, in GetMealPlanInput) (*mcp.CallToolResult, GetMealPlanOutput, error) {
entries, err := t.store.GetMealPlan(ctx, in.WeekStart)
if err != nil {
return nil, GetMealPlanOutput{}, err
}
if entries == nil {
entries = []ext.MealPlanEntry{}
}
return nil, GetMealPlanOutput{Entries: entries}, nil
}
// func (t *MealsTool) GetMealPlan(ctx context.Context, _ *mcp.CallToolRequest, in GetMealPlanInput) (*mcp.CallToolResult, GetMealPlanOutput, error) {
// entries, err := t.store.GetMealPlan(ctx, in.WeekStart)
// if err != nil {
// return nil, GetMealPlanOutput{}, err
// }
// if entries == nil {
// entries = []ext.MealPlanEntry{}
// }
// return nil, GetMealPlanOutput{Entries: entries}, nil
// }
// generate_shopping_list
// // generate_shopping_list
type GenerateShoppingListInput struct {
WeekStart time.Time `json:"week_start" jsonschema:"Monday of the week to generate shopping list for"`
}
// type GenerateShoppingListInput struct {
// WeekStart time.Time `json:"week_start" jsonschema:"Monday of the week to generate shopping list for"`
// }
type GenerateShoppingListOutput struct {
ShoppingList ext.ShoppingList `json:"shopping_list"`
}
// type GenerateShoppingListOutput struct {
// ShoppingList ext.ShoppingList `json:"shopping_list"`
// }
func (t *MealsTool) GenerateShoppingList(ctx context.Context, _ *mcp.CallToolRequest, in GenerateShoppingListInput) (*mcp.CallToolResult, GenerateShoppingListOutput, error) {
list, err := t.store.GenerateShoppingList(ctx, in.WeekStart)
if err != nil {
return nil, GenerateShoppingListOutput{}, err
}
return nil, GenerateShoppingListOutput{ShoppingList: list}, nil
}
// func (t *MealsTool) GenerateShoppingList(ctx context.Context, _ *mcp.CallToolRequest, in GenerateShoppingListInput) (*mcp.CallToolResult, GenerateShoppingListOutput, error) {
// list, err := t.store.GenerateShoppingList(ctx, in.WeekStart)
// if err != nil {
// return nil, GenerateShoppingListOutput{}, err
// }
// return nil, GenerateShoppingListOutput{ShoppingList: list}, nil
// }