Upload Lab Results (MCP)
Upload a PDF, review extracted values, approve.
Three ways in
| Tool | Use when |
|---|---|
getLabResultFileUploadEndpoint() | Preferred on an API key (bk_*) connection where the agent can make HTTP requests. Returns the multipart upload URL and a cURL example. On an app connected by signing in it returns the upload page link instead. |
getLabResultUploadLink() | The user uploads the PDF on the Betterness upload page. |
add_document(title, results) | The user showed the report in the chat. Saves the values you read as an unverified transcription; they reach the biomarkers after the user attaches the original. See Documents. |
Step-by-step
- Call
getLabResultFileUploadEndpoint()— returnsuploadUrl,method,contentType,fileField,maxSizeMB, and a ready-to-use cURL example - Upload the PDF:
POSTwith multipart body, field namefile,Authorization: Bearer bk_* - Poll
getUserLabRecords()for status — PENDING → PROCESSING → PROCESSED (usually seconds to minutes) - Once PROCESSED:
getLabRecordDetail(externalId)— review patient info, test details, biomarker array - If anything looks wrong:
updateLabResultBiomarker— fix or delete an individual biomarkerupdateLabResultMetadata— fix patient or test details
updateLabResultStatus(externalId, "APPROVE")— biomarkers become visible insearchBiomarkersand biological age recalculates
If extraction was wrong
updateLabResultStatus(externalId, "REPROCESS")— re-runs PDF extractionupdateLabResultStatus(externalId, "ROLLBACK")— reverts APPROVED → PROCESSED (hides biomarkers)
Tips
- Always show the extracted values to the user and get explicit approval before calling
APPROVE - The cURL example in
getLabResultFileUploadEndpointis copy-paste ready — agents can render it for the user when MCP HTTP isn't available

