Skip to content

Add set_macro_split tool and report the split in get_macro_targets - #80

Open
paultristanwagner wants to merge 2 commits into
rwestergren:mainfrom
paultristanwagner:macro-split
Open

paultristanwagner wants to merge 2 commits into
rwestergren:mainfrom
paultristanwagner:macro-split

Conversation

@paultristanwagner

Copy link
Copy Markdown

All code in this PR was written by an AI agent (Claude Opus 5.5) working with me; I directed it and tested the results on my own account. Feel free to take, change or drop any part of it.

Part of #73.

Adds a set_macro_split tool, and get_macro_targets now reports the
current split. On accounts without macro schedules or templates (the
free tier), get_macro_targets returned two empty lists.

The app stores the split as three profile prefs (percent of energy). It
changes them with POST /api/v2/set_pref, one call per changed macro:

{"key": "macroProtein", "val": "30.0", "auth": {…}, "config": {"call_version": 1}}

The keys are macroProtein, macroCarbs and macroLipids. Current values
are in get_profile → prefs, a list of one-key objects. Verified against
the live API: a split written this way reads back unchanged, and the
per-nutrient targets (GET /api/v3/user/{id}/targets) were unchanged
afterwards.

Changes:

  • client: get_macro_split() reads the prefs.
    set_macro_split(protein, carbs, fat) checks that each share is 0-100
    and that they add up to 100, then writes all three.
  • server: set_macro_split tool. Its description tells the model to
    confirm with the user and to read the old split first. get_macro_targets
    gains a macro_split field.
  • README: tool table rows.

https://claude.ai/code/session_01MCJFDo71qoSqTRtcGfkpXJ

The app stores the macro split as three profile prefs (macroProtein,
macroCarbs, macroLipids, percent of energy) and changes them with
/api/v2/set_pref. Verified against the live API: a split set this way
reads back unchanged from get_profile.

Claude-Session: https://claude.ai/code/session_01MCJFDo71qoSqTRtcGfkpXJ

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant