Skip to main content
Glama

Write metrics

write_metrics
DestructiveIdempotent

Save the readings of one lab report to the user's freddy, for one lab and one collection day. A report can also be a body composition scan (BIA or DEXA), a bone density scan, body measurements, a fitness test, a sleep study, a lung function test (spirometry) or an ECG: save each value that the report prints, also each value per arm, leg or trunk. Their new markers match only by a LOINC code that the report prints or by id: get the ids of a group with list, and pick the marker that fits the name, the body part, the side and the unit. For such a report, send the id of the group's marker that names the measurement the report prints, also when the name matches another marker. One save holds one reading per marker and day: freddy refuses a save that repeats a marker (lactate at each stage of a step test). Before you save: show the user every reading in a table and get an explicit yes. Copy each name, value, unit and range exactly as printed. Leave a field out when the report does not print it. Each reading must match a marker of freddy's list. Send the LOINC code only when the report prints it. When the report is not in English, also send the English name of each test in english. Call first with check: true: freddy then says which marker each reading matches and suggests markers for the others, and stores nothing. For a reading with no match, call with list (and day) to get the markers of a group. Then save each reading with the id of its marker. Also send each reading with no matching marker in the save: freddy does not save it, but files a request for the marker, and the user can import the report again once the marker is added. To correct a reading, save it again. To delete one, put its marker id in remove. Saved readings (source "Lab results", metrics lab_*) are as the report printed them: the range is the lab's own range, and one marker from two labs can have two names and two units.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "day": "<day>"
    },
    "name": "write_metrics"
  }
}

Input Schema

NameRequiredDescriptionDefault
dayYesThe collection day as printed, YYYY-MM-DD.
listNoSend alone with day, no readings and no remove: freddy lists the markers of one group (id, name, units) and stores nothing, so you can send the exact id. Add words to list only the markers whose name or other name holds them; a group with many markers needs words.
timeNoThe collection time as printed, local, with no offset.
checkNotrue: match the readings to markers and store nothing.
issuerNoThe lab name as printed.
removeNoSaved readings of this day and lab to delete: the marker id (or lab_<id>) of each.
readingsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / list / description
      Previous value: -"Send alone with day, no readings and no remove: freddy lists the markers of one group (id, name, units) and stores nothing, so you can send the exact id. Add words to list only the markers whose name holds them; a group with many markers needs words."New value: +"Send alone with day, no readings and no remove: freddy lists the markers of one group (id, name, units) and stores nothing, so you can send the exact id. Add words to list only the markers whose name or other name holds them; a group with many markers needs words."
    • changedInput schema / properties / list / properties / group / enum
      Previous value: -[
      -  "blood_count",
      -  "lipids",
      -  "glucose",
      -  "liver",
      -  "kidney",
      -  "minerals",
      -  "thyroid",
      -  "hormones",
      -  "vitamins_iron",
      -  "inflammation",
      -  "urine",
      -  "body_composition",
      -  "bone_density",
      -  "body_measurements",
      -  "fitness",
      -  "sleep",
      -  "other"
      -]New value: +[
      +  "blood_count",
      +  "lipids",
      +  "glucose",
      +  "liver",
      +  "kidney",
      +  "minerals",
      +  "thyroid",
      +  "hormones",
      +  "vitamins_iron",
      +  "inflammation",
      +  "urine",
      +  "body_composition",
      +  "bone_density",
      +  "body_measurements",
      +  "fitness",
      +  "sleep",
      +  "lung",
      +  "heart",
      +  "other"
      +]
  2. Changed1 schema field changed
    • addedInput schema / properties / list
      Added value: +{
      +  "description": "Send alone with day, no readings and no remove: freddy lists the markers of one group (id, name, units) and stores nothing, so you can send the exact id. Add words to list only the markers whose name holds them; a group with many markers needs words.",
      +  "properties": {
      +    "group": {
      +      "enum": [
      +        "blood_count",
      +        "lipids",
      +        "glucose",
      +        "liver",
      +        "kidney",
      +        "minerals",
      +        "thyroid",
      +        "hormones",
      +        "vitamins_iron",
      +        "inflammation",
      +        "urine",
      +        "body_composition",
      +        "bone_density",
      +        "body_measurements",
      +        "fitness",
      +        "sleep",
      +        "other"
      +      ],
      +      "type": "string"
      +    },
      +    "words": {
      +      "maxLength": 200,
      +      "minLength": 1,
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "group"
      +  ],
      +  "type": "object"
      +}
  3. Added

TDQS

A4.1/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly=false, destructive=true and idempotent=true, and the description adds real context on top: check and list store nothing, a repeated marker in one save is refused, unmatched readings are saved as marker requests rather than data, and resaving is the correction path. It also discloses that stored readings preserve the lab's own range and that one marker can carry two names and units across labs. The deletion behavior via remove is consistent with destructiveHint=true.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded in the first sentence, but the body is a dense run-on chain of clauses separated by colons, with repeated statements about unmatched readings and marker ids across several sentences. Every topic is relevant, yet the ordering jumps between matching rules, safety confirmation, deletion, and storage semantics, making it harder to scan than it needs to be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a seven-parameter, nested-schema write tool with no output schema, the description covers the check reply, the list reply, the save outcome and the unmatched-marker path, which is what an agent needs to invoke it correctly. It does not say what the save call returns or how errors are reported, but those gaps are modest given the schema's own field documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 86%, so the baseline is 3, but the description adds meaning the schema does not: LOINC code only when the report prints it and never from memory, the english field is used only for matching and not stored, unmatched readings still go in the save so a marker request is filed, and remove takes a marker id or lab_<id>. That materially improves how an agent fills the readings array.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence gives a specific verb and resource: save the readings of one lab report into the user's profile, and it enumerates the report types it accepts (BIA, DEXA, spirometry, ECG, sleep study). It also separates the write path from the check and list modes. It never contrasts itself with query_metrics or list_metrics, and the embedded 'list' parameter can be confused with the sibling tool of the same name, so sibling differentiation is incomplete.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Strong procedural guidance: call first with check: true, use list with a group when a reading has no match, show the user a table and get an explicit yes before saving, resave to correct and use remove to delete. It defines the order of operations step by step. It stops short of stating when this tool should not be used, such as deferring to query_metrics for reading existing data.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources