diff --git a/README.md b/README.md index 7ad18cb9f1c4891ad10600929244fd657d15e66f..01dc375389ece4bfcb1992f641a06a2aedd9bdce 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,11 @@ I'm currently using `google/gemini-2.5-flash-preview:thinking` through > > Task names should be in sentence case. > -> For every request to create a task/reminder: +> When asked to mark something complete or when the user says they've done +> something and you have no other context, check the list_habits_and_activities +> tool for related entries. If one matches, pass its ID to track_habit_activity. +> +> For every request to create or change a task/reminder: > > 1. List the areas and goals and consider which one area is most relevant. > Consider whether the task belongs within any of that area's goals. diff --git a/main.go b/main.go index b519a671183d70a2ad9daefb4c21e21942f42923..2bdf8944caef60c661c8560fc18e5fc60dbda9d5 100644 --- a/main.go +++ b/main.go @@ -51,7 +51,7 @@ type Config struct { Areas []Area `toml:"areas"` Server ServerConfig `toml:"server"` Timezone string `toml:"timezone"` - Habits []Habit `toml:"habits"` + Habit []Habit `toml:"habit"` } var version = "" @@ -218,27 +218,6 @@ func NewMCPServer(config *Config) *server.MCPServer { }, ) - mcpServer.AddTool( - mcp.NewTool( - "list_habits", - mcp.WithDescription("List habits and their IDs."), - ), - func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { - var b strings.Builder - for _, habit := range config.Habits { - fmt.Fprintf(&b, "- %s: %s\n", habit.Name, habit.ID) - } - return &mcp.CallToolResult{ - Content: []mcp.Content{ - mcp.TextContent{ - Type: "text", - Text: b.String(), - }, - }, - }, nil - }, - ) - mcpServer.AddTool(mcp.NewTool("create_task", mcp.WithDescription("Creates a new task"), mcp.WithString("area_id", @@ -334,8 +313,29 @@ func NewMCPServer(config *Config) *server.MCPServer { return handleDeleteTask(ctx, request, config) }) + mcpServer.AddTool( + mcp.NewTool( + "list_habits_and_activities", + mcp.WithDescription("List habits and their IDs for tracking or marking complete with tracking_habit_activity"), + ), + func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { + var b strings.Builder + for _, habit := range config.Habit { + fmt.Fprintf(&b, "- %s: %s\n", habit.Name, habit.ID) + } + return &mcp.CallToolResult{ + Content: []mcp.Content{ + mcp.TextContent{ + Type: "text", + Text: b.String(), + }, + }, + }, nil + }, + ) + mcpServer.AddTool(mcp.NewTool("track_habit_activity", - mcp.WithDescription("Tracks an activity for a habit in Lunatask"), + mcp.WithDescription("Tracks an activity or a habit in Lunatask"), mcp.WithString("habit_id", mcp.Description("ID of the habit to track activity for."), mcp.Required(), @@ -757,7 +757,7 @@ func createDefaultConfigFile(configPath string) { ID: "goal-id-placeholder", }}, }}, - Habits: []Habit{{ + Habit: []Habit{{ Name: "Example Habit", ID: "habit-id-placeholder", }},