---
title: "Structured inputs and structured responses"
kind: "explain"
audiences: ["strategist","rep"]
track: "agent-fundamentals"
date: "2026-07-29"
summary: "See how ordinary field language becomes validated tool arguments, durable CRM fields, and a conversational explanation."
html_url: /library/learn/structured-inputs-and-responses
markdown_url: /library/learn/structured-inputs-and-responses.md
---

# Structured inputs and structured responses

See how ordinary field language becomes validated tool arguments, durable CRM fields, and a conversational explanation.

**By the end:** You can inspect the structured data behind an agent action, understand validation failures, and keep important outcomes and follow-ups out of undifferentiated notes.

Agent Fundamentals · 14 min · Practical

## Conversation is flexible; a system of record needs structure

Field language is naturally messy: “Saw Dr. Patel, good conversation, send the reimbursement sheet Thursday.” A model can interpret that sentence, but mydoclist should not store the entire meaning as one opaque note.

A structured tool request separates the practice or person ID, activity type, date, outcome, follow-up date, and notes. Fields have names and expected types. Some are required; some accept only a known set of values. Validation catches missing or malformed arguments before they become CRM state.

The structured tool result is also different from the prose response. The result carries stable identifiers, field values, status, and errors. The agent’s conversational explanation makes that result easier to read, but it is not the record itself.

## From field language to a reviewable result

1. **Ordinary language** (owner: You): Describe what happened, the outcome, and the next action in the language you naturally use.
2. **Tool selection** (owner: AI application): The agent identifies the available tool whose contract matches the job.
3. **Typed arguments** (owner: AI + tool schema): Names, IDs, dates, enum values, and required fields are separated into a predictable payload.
4. **Validation** (owner: mydoclist): The system rejects missing fields, invalid dates, unsupported values, or ambiguous identity before writing.
5. **Structured result** (owner: mydoclist): A preview or read result returns stable fields, identifiers, evidence, and status.
6. **Conversational explanation** (owner: AI application): The agent summarizes the result and asks for clarification or confirmation when required.

## A visit becomes typed arguments

This simplified trace shows why outcome and follow-up remain queryable instead of being buried in notes.

1. **1 · Field language**: `“Met Dr. Patel at Cherry Creek Example Gastro today. Interested; send the reimbursement guide Thursday. We discussed the new protocol.”`. One natural sentence contains identity, timing, outcome, next action, and notes.
2. **2 · Typed arguments**: `{ "site_id": "site_…", "directory_record_id": "contact_…", "activity_type": "visit", "activity_date": "2026-07-29", "outcome": "interested", "follow_up_date": "2026-07-30", "notes": "Discussed the new protocol; send reimbursement guide." }`. Stable IDs prevent a same-name mismatch; the outcome and follow-up date become explicit fields.
3. **3 · Validation**: `status: valid · effect: draft_only`. Dates and allowed values pass validation. The write is still only a preview.
4. **4 · Structured result**: `{ "preview": { "practice": "Cherry Creek Example Gastro", "outcome": "interested", "follow_up_date": "2026-07-30" }, "confirmation_token": "…" }`. The tool returns exactly what is staged plus the token needed for a separate confirmation.
5. **5 · Explanation**: `“I drafted today’s visit with outcome Interested and a Thursday follow-up. Confirm it?”`. The prose is useful, but the structured preview is what you inspect before authorizing the write.

## Ask to see the fields before confirming

Use this when a dictated note contains several effects or when identity could be ambiguous.

Prompt `inspect-structured-activity`:

> Draft this activity from my field note: {{fieldNote}}
>
> Before asking me to confirm, show the structured values for:
> - practice and person, including the resolved IDs
> - activity type and date
> - outcome
> - follow-up date and next action
> - notes
>
> Call out every missing, ambiguous, or invalid value. Do not commit the activity until I review the preview and explicitly confirm it.

- {{fieldNote}} (Field note): Saw Dr. Patel at Cherry Creek Example Gastro; interested; send reimbursement guide Thursday.

Before sending:

- Do not include patient information or PHI.
- Follow your customer’s policy for what may be shared with the selected AI application.

## An ambiguous date should stop the draft

**Situation:** A rep dictates “follow up next Thursday” late on a Thursday, and two contacts named Dr. Patel exist in the book.

**Input:**

> Draft the visit, but show me any identity or date ambiguity before creating the preview.

**Expected output:**

- The agent presents the two matching contacts with practice context instead of guessing an ID.
- The exact follow-up date is stated in ISO form and plain language for confirmation.
- Only after identity and date are resolved does log_activity return a structured preview.
- The conversational summary repeats the resolved values rather than hiding them.

**Takeaway:** Validation friction is useful when the alternative is a cleanly formatted activity attached to the wrong person or date.

## Review the record-shaped artifact

Inspect the structured preview, not only the agent’s sentence saying the draft looks right.

- Do the stable person and practice IDs represent the intended account?
- Are date values explicit and in the intended timezone?
- Did the outcome land in its field rather than only in notes?
- Is the follow-up a real field or task that can be found later?
- Does the preview remain uncommitted until confirmation?

## When structure rejects the request

- **A required value is missing.**
  Likely cause: The field note never specified an activity date, subject, or other required field.
  Recovery: Supply the missing value. Do not ask the agent to invent a date, person, or outcome.
- **A value fails validation.**
  Likely cause: The argument has the wrong type, an unsupported enum value, or a date that cannot be parsed safely.
  Recovery: Read the validation message, choose an allowed value, and retry the draft with the corrected field.
- **The prose sounds correct but the record is wrong.**
  Likely cause: The agent summarized intent while the structured arguments resolved a different entity or field.
  Recovery: Correct the structured identity or argument and regenerate the preview. Editing only the prose does not repair the record.

## Related modules

- [How context works](how-context-works.md): Understand what an agent can see now, what persists elsewhere, and how to supply only the context a field job needs.
- [How tool calls work](how-tool-calls-work.md): See how an agent moves from a request to structured arguments, a mydoclist result, and a response you can review.
- [Log a visit and capture follow-up](log-visit-and-follow-up.md): Turn a fresh parking-lot note into a reviewable activity and a follow-up you can find when it matters.
- [Verify an agent’s work](verify-agent-work.md): Use evidence, freshness, data semantics, and staged effects to inspect consequential claims without turning every answer into an investigation.
- [How mydoclist connects to Claude and ChatGPT](how-mydoclist-connects-to-claude-and-chatgpt.md): See what an MCP connection makes available, how current data travels through it, and why every proposed CRM change still stops for your review.
