{"openapi":"3.1.0","info":{"title":"Dear Farm — external agent API","version":"1.0.0","description":"Read and add to a farmer's record from an agent running elsewhere. Authenticate with a key the farmer issues in Settings → External Agents, sent as the x-agent-key header or as an Authorization bearer token. No external key can write the agent's knowledge graph; report to it with POST /api/agent/memory/request instead. Writes on this API are immediate — there is no approval step."},"servers":[{"url":"https://www.dear.farm"}],"components":{"securitySchemes":{"agentKey":{"type":"apiKey","in":"header","name":"x-agent-key","description":"A per-agent key issued by the farmer. Pins the organization, user and role every call runs as."},"bearerKey":{"type":"http","scheme":"bearer","description":"The same per-agent key, sent as a bearer token. Equivalent to the x-agent-key header; send one or the other."}},"schemas":{"Tool_get_farms":{"type":"object","title":"get_farms","description":"List every farm this key can reach, with id, name, address, size in acres and notes. Start here — most other tools need a farm_id. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_farms"},"input":{"type":"object","properties":{},"additionalProperties":false}},"required":["tool"],"additionalProperties":false},"Tool_update_farm":{"type":"object","title":"update_farm","description":"Edit a farm's name, address or notes. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"update_farm"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm to edit.","format":"uuid"},"name":{"type":"string","description":"New name. Omit to leave unchanged."},"address":{"type":"string","description":"New address. Omit to leave unchanged."},"notes":{"type":"string","description":"New notes. Omit to leave unchanged."}},"required":["farm_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_plots":{"type":"object","title":"get_plots","description":"List the plots on one farm. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_plots"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm whose plots to list.","format":"uuid"}},"required":["farm_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_create_plot":{"type":"object","title":"create_plot","description":"Create a plot on a farm. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"create_plot"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm to create the plot on.","format":"uuid"},"name":{"type":"string","description":"Plot name, e.g. 'North terrace'."},"description":{"type":"string","description":"Free text about the plot."},"crop_type":{"type":"string","description":"What is grown here, e.g. 'coffee'."},"variety":{"type":"string","description":"Cultivar or variety."},"plant_count":{"type":"number","description":"How many plants the plot holds."},"water_schedule":{"type":"string","description":"Free text, e.g. 'drip, alternate days'."},"hardiness_zone":{"type":"string","description":"USDA-style zone string."},"soil_type":{"type":"string","description":"Free text, e.g. 'red laterite'."}},"required":["farm_id","name"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_update_plot":{"type":"object","title":"update_plot","description":"Edit a plot. Every field is optional; omitted fields are left alone. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"update_plot"},"input":{"type":"object","properties":{"plot_id":{"type":"string","description":"The plot to edit.","format":"uuid"},"name":{"type":"string","description":"New name."},"description":{"type":"string","description":"New description. Send an empty string to clear it."},"crop_type":{"type":"string","description":"New crop type."},"variety":{"type":"string","description":"New variety."},"plant_count":{"type":"number","description":"New plant count."}},"required":["plot_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_delete_plot":{"type":"object","title":"delete_plot","description":"Delete a plot. The delete is soft — the record is hidden from every read, not destroyed — but there is no tool here to bring it back. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"delete_plot"},"input":{"type":"object","properties":{"plot_id":{"type":"string","description":"The plot to delete.","format":"uuid"}},"required":["plot_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_plants":{"type":"object","title":"get_plants","description":"List the plants on one farm. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_plants"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm whose plants to list.","format":"uuid"}},"required":["farm_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_create_plant":{"type":"object","title":"create_plant","description":"Record a plant (or a group of plants) on a farm. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"create_plant"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm the plant is on.","format":"uuid"},"plot_id":{"type":"string","description":"Attach to a specific plot. Omit for farm level.","format":"uuid"},"label":{"type":"string","description":"How the farmer refers to it, e.g. 'Row 4 arabica'."},"crop_catalog_id":{"type":"string","description":"Link to a catalog entry. Find one with search_catalog first — it fills in the botany.","format":"uuid"},"common_name":{"type":"string","description":"Common name, if not using the catalog."},"scientific_name":{"type":"string","description":"Binomial name, if not using the catalog."},"variety":{"type":"string","description":"Cultivar or variety."},"plant_category":{"type":"string","description":"Botanical category.","enum":["tree","shrub","vine","herb","grass","ground_cover","succulent","fern","aquatic","leafy_green","root_vegetable","fruit","legume","grain_cereal","flower_ornamental"]},"lifecycle_type":{"type":"string","description":"How long the plant lives.","enum":["annual","biennial","perennial"]},"quantity":{"type":"number","description":"How many plants this record stands for. Defaults to 1."},"planted_date":{"type":"string","description":"When it went in the ground (YYYY-MM-DD).","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"health_status":{"type":"string","description":"Current condition. Defaults to healthy.","enum":["healthy","stressed","diseased","dormant","dead","removed"]},"growth_stage":{"type":"string","description":"Where it is in its life.","enum":["seedling","juvenile","mature","fruiting","senescent"]},"notes":{"type":"string","description":"Free text about this plant."}},"required":["farm_id","label"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_update_plant":{"type":"object","title":"update_plant","description":"Edit a plant. Use this to record a change in health or growth stage — it is the most common write after an inspection. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"update_plant"},"input":{"type":"object","properties":{"plant_id":{"type":"string","description":"The plant to edit.","format":"uuid"},"label":{"type":"string","description":"New label."},"health_status":{"type":"string","description":"New condition.","enum":["healthy","stressed","diseased","dormant","dead","removed"]},"growth_stage":{"type":"string","description":"New growth stage.","enum":["seedling","juvenile","mature","fruiting","senescent"]},"quantity":{"type":"number","description":"New count."},"notes":{"type":"string","description":"New notes. Send an empty string to clear them."}},"required":["plant_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_delete_plant":{"type":"object","title":"delete_plant","description":"Delete a plant record. Soft, like every delete here. If a plant died, prefer update_plant with health_status 'dead' — that keeps the history. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"delete_plant"},"input":{"type":"object","properties":{"plant_id":{"type":"string","description":"The plant to delete.","format":"uuid"}},"required":["plant_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_recent_activity":{"type":"object","title":"get_recent_activity","description":"The most recent activity logs on a farm, newest first. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_recent_activity"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm whose activity to read.","format":"uuid"},"limit":{"type":"number","description":"How many entries to return. Defaults to 10."}},"required":["farm_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_activity_types":{"type":"object","title":"get_activity_types","description":"The activity type vocabulary for this organization — slug, label, group and colour. Call this before create_activity_log to get a valid log_type slug. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_activity_types"},"input":{"type":"object","properties":{},"additionalProperties":false}},"required":["tool"],"additionalProperties":false},"Tool_create_activity_log":{"type":"object","title":"create_activity_log","description":"Log something that was done on the farm — watering, pruning, spraying, a harvest. This is the right home for transient events; do not report them to the Mind. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"create_activity_log"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm the work happened on.","format":"uuid"},"title":{"type":"string","description":"Short description of the work, e.g. 'Pruned north block'."},"plot_id":{"type":"string","description":"Attach to a specific plot. Omit for farm level.","format":"uuid"},"notes":{"type":"string","description":"Longer detail."},"log_date":{"type":"string","description":"When the work happened (YYYY-MM-DD). Defaults to today.","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"end_date":{"type":"string","description":"For work spanning days, the last day (YYYY-MM-DD).","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"log_type":{"type":"string","description":"An activity type slug from get_activity_types. An unrecognised slug is stored as-is and will not group correctly in the app."}},"required":["farm_id","title"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_update_activity_log":{"type":"object","title":"update_activity_log","description":"Edit an activity log entry. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"update_activity_log"},"input":{"type":"object","properties":{"log_id":{"type":"string","description":"The entry to edit.","format":"uuid"},"title":{"type":"string","description":"New title."},"notes":{"type":"string","description":"New notes. Send an empty string to clear them."},"log_type":{"type":"string","description":"New activity type slug."},"log_date":{"type":"string","description":"New date (YYYY-MM-DD).","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"end_date":{"type":"string","description":"New end date (YYYY-MM-DD).","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["log_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_delete_activity_log":{"type":"object","title":"delete_activity_log","description":"Delete an activity log entry. Soft. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"delete_activity_log"},"input":{"type":"object","properties":{"log_id":{"type":"string","description":"The entry to delete.","format":"uuid"}},"required":["log_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_notes":{"type":"object","title":"get_notes","description":"Recent notes on a farm. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_notes"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm whose notes to read.","format":"uuid"},"limit":{"type":"number","description":"How many notes to return. Defaults to 10."}},"required":["farm_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_create_note":{"type":"object","title":"create_note","description":"Write a note against a farm, plot or plant — an observation that is not a task that was performed. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"create_note"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm the note belongs to.","format":"uuid"},"content":{"type":"string","description":"The note body."},"plot_id":{"type":"string","description":"Attach to a specific plot. Omit for farm level.","format":"uuid"},"plant_id":{"type":"string","description":"Attach to a specific plant.","format":"uuid"}},"required":["farm_id","content"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_update_note":{"type":"object","title":"update_note","description":"Replace a note's content. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"update_note"},"input":{"type":"object","properties":{"note_id":{"type":"string","description":"The note to edit.","format":"uuid"},"content":{"type":"string","description":"The new body. This replaces the old one entirely."}},"required":["note_id","content"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_delete_note":{"type":"object","title":"delete_note","description":"Delete a note. Soft. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"delete_note"},"input":{"type":"object","properties":{"note_id":{"type":"string","description":"The note to delete.","format":"uuid"}},"required":["note_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_calendar_events":{"type":"object","title":"get_calendar_events","description":"Calendar events on a farm within a date window. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_calendar_events"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm whose calendar to read.","format":"uuid"},"start_date":{"type":"string","description":"Window start (YYYY-MM-DD). Defaults to today.","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"end_date":{"type":"string","description":"Window end (YYYY-MM-DD). Defaults to 30 days from today.","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["farm_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_create_calendar_event":{"type":"object","title":"create_calendar_event","description":"Put something on the farm calendar. Lands on the farm's system calendar; the farm must already have one. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"create_calendar_event"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm whose calendar to write to.","format":"uuid"},"summary":{"type":"string","description":"Event title."},"start_date":{"type":"string","description":"When it starts (YYYY-MM-DD).","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"end_date":{"type":"string","description":"When it ends (YYYY-MM-DD). Defaults to same as start_date.","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":{"type":"string","description":"Longer detail."},"all_day":{"type":"boolean","description":"Pass false only for a timed event. Defaults to true."},"location":{"type":"string","description":"Where it happens."},"plot_id":{"type":"string","description":"Attach to a specific plot. Omit for farm level.","format":"uuid"}},"required":["farm_id","summary","start_date"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_delete_calendar_event":{"type":"object","title":"delete_calendar_event","description":"Remove a calendar event. Unlike the other deletes here this one is HARD — the row is removed and cannot be recovered. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'farm:write' scope.","properties":{"tool":{"type":"string","const":"delete_calendar_event"},"input":{"type":"object","properties":{"event_id":{"type":"string","description":"The event to remove.","format":"uuid"}},"required":["event_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_weather":{"type":"object","title":"get_weather","description":"Daily forecast for a farm's location — max/min temperature, precipitation, wind and weather code. Needs the farm to have a location set. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_weather"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"The farm to forecast for.","format":"uuid"},"days":{"type":"number","description":"How many days ahead. Defaults to 7."}},"required":["farm_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_search_catalog":{"type":"object","title":"search_catalog","description":"Search the shared crop catalog by name, variety, crop type or scientific name. Returns up to 5 matches. Use the id with create_plant or get_crop_enrichment. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"search_catalog"},"input":{"type":"object","properties":{"query":{"type":"string","description":"What to search for, e.g. 'arabica'."}},"required":["query"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_crop_enrichment":{"type":"object","title":"get_crop_enrichment","description":"Read one section of the researched detail behind a catalog entry. Returns a 'not available yet' message rather than an error when the section has not been generated. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_crop_enrichment"},"input":{"type":"object","properties":{"crop_catalog_id":{"type":"string","description":"Catalog entry id, from search_catalog.","format":"uuid"},"section":{"type":"string","description":"Which section to read.","enum":["growing_conditions","pest_profile","companion_plants","revenue_potential","products","regional_notes"]}},"required":["crop_catalog_id","section"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_attachments":{"type":"object","title":"get_attachments","description":"List the files attached to one record. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_attachments"},"input":{"type":"object","properties":{"entity_type":{"type":"string","description":"What kind of record.","enum":["farm","plot","plant","note","farmLog"]},"entity_id":{"type":"string","description":"The record's id.","format":"uuid"}},"required":["entity_type","entity_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_plant_stats":{"type":"object","title":"get_plant_stats","description":"Counts of plants grouped by category, health and lifecycle. Omit farm_id for a total across every farm this key can reach. Requires the 'farm:read' scope.","properties":{"tool":{"type":"string","const":"get_plant_stats"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"Limit to one farm. Omit for all of them.","format":"uuid"}},"additionalProperties":false}},"required":["tool"],"additionalProperties":false},"Tool_get_pending_events":{"type":"object","title":"get_pending_events","description":"Things that happened in the app since anyone last asked. DRAINS ON READ: each event is delivered exactly once, to whichever caller asks first, so a second agent polling the same organization does not see them — it takes them. Returns up to 50. Requires the 'events:consume' scope.","properties":{"tool":{"type":"string","const":"get_pending_events"},"input":{"type":"object","properties":{},"additionalProperties":false}},"required":["tool"],"additionalProperties":false},"Tool_read_memory":{"type":"object","title":"read_memory","description":"Read the farmer's knowledge graph — what Dear Farm's own agent has concluded about them and their land. Requires the 'memory:read' scope.","properties":{"tool":{"type":"string","const":"read_memory"},"input":{"type":"object","properties":{"query":{"type":"string","description":"Narrow to matching nodes. Omit for a summary of the whole graph."}},"additionalProperties":false}},"required":["tool"],"additionalProperties":false},"Tool_get_memory_graph":{"type":"object","title":"get_memory_graph","description":"Node and edge counts plus a prose summary of the graph. Requires the 'memory:read' scope.","properties":{"tool":{"type":"string","const":"get_memory_graph"},"input":{"type":"object","properties":{},"additionalProperties":false}},"required":["tool"],"additionalProperties":false},"Tool_get_system_prompt":{"type":"object","title":"get_system_prompt","description":"The composed system prompt Dear Farm's own agent runs under — its active personality and the farmer's standing instructions. Read it to stay consistent with how that agent behaves. Requires the 'memory:read' scope.","properties":{"tool":{"type":"string","const":"get_system_prompt"},"input":{"type":"object","properties":{},"additionalProperties":false}},"required":["tool"],"additionalProperties":false},"Tool_get_research_report":{"type":"object","title":"get_research_report","description":"Load a research report in full — title, summary, markdown body, findings and sources. Requires the 'memory:read' scope.","properties":{"tool":{"type":"string","const":"get_research_report"},"input":{"type":"object","properties":{"report_id":{"type":"string","description":"The report to load.","format":"uuid"}},"required":["report_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_get_expenses":{"type":"object","title":"get_expenses","description":"List expenses, newest first. Requires the 'expenses' scope.","properties":{"tool":{"type":"string","const":"get_expenses"},"input":{"type":"object","properties":{"farm_id":{"type":"string","description":"Limit to one farm.","format":"uuid"},"category":{"type":"string","description":"Limit to one category."},"limit":{"type":"number","description":"How many to return. Defaults to 20."}},"additionalProperties":false}},"required":["tool"],"additionalProperties":false},"Tool_create_expense":{"type":"object","title":"create_expense","description":"Record an expense. It lands as a draft — the farmer confirms it in the app before it syncs to their accounting system. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'expenses' scope.","properties":{"tool":{"type":"string","const":"create_expense"},"input":{"type":"object","properties":{"amount":{"type":"number","description":"The amount. Positive."},"description":{"type":"string","description":"What it was for."},"farm_id":{"type":"string","description":"Which farm to book it against.","format":"uuid"},"plot_id":{"type":"string","description":"Attach to a specific plot. Omit for farm level.","format":"uuid"},"currency":{"type":"string","description":"ISO 4217 code, e.g. 'INR'. Defaults to USD."},"category":{"type":"string","description":"Free text matching the farmer's accounting categories, e.g. 'Fertilizer'."},"merchant":{"type":"string","description":"Who was paid."},"expense_date":{"type":"string","description":"When it was incurred (YYYY-MM-DD). Defaults to today.","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"metadata":{"type":"object","description":"Free-form extra fields kept with the expense."}},"required":["amount","description"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_update_expense":{"type":"object","title":"update_expense","description":"Edit an expense. Every field is optional. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'expenses' scope.","properties":{"tool":{"type":"string","const":"update_expense"},"input":{"type":"object","properties":{"expense_id":{"type":"string","description":"The expense to edit.","format":"uuid"},"amount":{"type":"number","description":"New amount."},"description":{"type":"string","description":"New description."},"category":{"type":"string","description":"New category."},"merchant":{"type":"string","description":"New merchant."},"farm_id":{"type":"string","description":"Move it to a different farm.","format":"uuid"},"plot_id":{"type":"string","description":"Attach to a specific plot. Omit for farm level.","format":"uuid"},"expense_date":{"type":"string","description":"New date (YYYY-MM-DD).","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"status":{"type":"string","description":"Sync lifecycle state. Leave this alone unless the farmer asked — moving an expense to 'confirmed' is what pushes it to their accounting system.","enum":["draft","confirmed","synced","sync_error"]}},"required":["expense_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false},"Tool_extract_expense_from_file":{"type":"object","title":"extract_expense_from_file","description":"Read a receipt that has already been uploaded and pull the amount, merchant, date and line items out of it. Upload the file first — this takes an attachment id, not bytes. WRITES IMMEDIATELY when called on this endpoint — there is no approval step here, so confirm with the farmer yourself before calling it. Requires the 'expenses' scope.","properties":{"tool":{"type":"string","const":"extract_expense_from_file"},"input":{"type":"object","properties":{"attachment_id":{"type":"string","description":"The uploaded receipt, from POST /api/agent/upload.","format":"uuid"}},"required":["attachment_id"],"additionalProperties":false}},"required":["tool","input"],"additionalProperties":false}}},"security":[{"agentKey":[]},{"bearerKey":[]}],"paths":{"/api/agent/tools":{"get":{"summary":"What this key can do. Returns every tool with its parameters and whether this key holds the scope for it — tools it cannot call are listed too, so the agent can ask the farmer for the right permission instead of guessing.","security":[{"agentKey":[]}],"responses":{"200":{"description":"Success."},"401":{"description":"Key missing, unknown or revoked."},"403":{"description":"Authenticated, but this key does not hold the required scope. The body names it."}}},"post":{"summary":"Run one tool. Body: { tool, input }. The scope required depends on the tool.","security":[{"agentKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Tool_get_farms"},{"$ref":"#/components/schemas/Tool_update_farm"},{"$ref":"#/components/schemas/Tool_get_plots"},{"$ref":"#/components/schemas/Tool_create_plot"},{"$ref":"#/components/schemas/Tool_update_plot"},{"$ref":"#/components/schemas/Tool_delete_plot"},{"$ref":"#/components/schemas/Tool_get_plants"},{"$ref":"#/components/schemas/Tool_create_plant"},{"$ref":"#/components/schemas/Tool_update_plant"},{"$ref":"#/components/schemas/Tool_delete_plant"},{"$ref":"#/components/schemas/Tool_get_recent_activity"},{"$ref":"#/components/schemas/Tool_get_activity_types"},{"$ref":"#/components/schemas/Tool_create_activity_log"},{"$ref":"#/components/schemas/Tool_update_activity_log"},{"$ref":"#/components/schemas/Tool_delete_activity_log"},{"$ref":"#/components/schemas/Tool_get_notes"},{"$ref":"#/components/schemas/Tool_create_note"},{"$ref":"#/components/schemas/Tool_update_note"},{"$ref":"#/components/schemas/Tool_delete_note"},{"$ref":"#/components/schemas/Tool_get_calendar_events"},{"$ref":"#/components/schemas/Tool_create_calendar_event"},{"$ref":"#/components/schemas/Tool_delete_calendar_event"},{"$ref":"#/components/schemas/Tool_get_weather"},{"$ref":"#/components/schemas/Tool_search_catalog"},{"$ref":"#/components/schemas/Tool_get_crop_enrichment"},{"$ref":"#/components/schemas/Tool_get_attachments"},{"$ref":"#/components/schemas/Tool_get_plant_stats"},{"$ref":"#/components/schemas/Tool_get_pending_events"},{"$ref":"#/components/schemas/Tool_read_memory"},{"$ref":"#/components/schemas/Tool_get_memory_graph"},{"$ref":"#/components/schemas/Tool_get_system_prompt"},{"$ref":"#/components/schemas/Tool_get_research_report"},{"$ref":"#/components/schemas/Tool_get_expenses"},{"$ref":"#/components/schemas/Tool_create_expense"},{"$ref":"#/components/schemas/Tool_update_expense"},{"$ref":"#/components/schemas/Tool_extract_expense_from_file"}]}}}},"responses":{"200":{"description":"Success."},"401":{"description":"Key missing, unknown or revoked."},"403":{"description":"Authenticated, but this key does not hold the required scope. The body names it."}}}},"/api/agent/memory":{"get":{"summary":"The knowledge graph as nodes and edges, for display. Add ?summary=true for prose instead.","security":[{"agentKey":[]}],"x-required-scope":"memory:read","responses":{"200":{"description":"Success."},"401":{"description":"Key missing, unknown or revoked."},"403":{"description":"Authenticated, but this key does not hold the required scope. The body names it."}}}},"/api/agent/memory/request":{"get":{"summary":"The reporting contract — what is worth reporting to the Mind and what is not. Read this once at session start.","security":[{"agentKey":[]}],"x-required-scope":"memory:request","responses":{"200":{"description":"Success."},"401":{"description":"Key missing, unknown or revoked."},"403":{"description":"Authenticated, but this key does not hold the required scope. The body names it."}}},"post":{"summary":"Report something you learned. Body: { observation }. Dear Farm's own agent decides whether to record it. This is the ONLY way anything external reaches the Mind.","security":[{"agentKey":[]}],"x-required-scope":"memory:request","responses":{"200":{"description":"Success."},"401":{"description":"Key missing, unknown or revoked."},"403":{"description":"Authenticated, but this key does not hold the required scope. The body names it."}}}},"/api/agent/upload":{"post":{"summary":"Upload a file as base64 and attach it to a record. Body: { file_base64, filename, content_type, entity_type, entity_id } — or set create_note: true with farm_id to file it onto a new note.","security":[{"agentKey":[]}],"x-required-scope":"attachments","responses":{"200":{"description":"Success."},"401":{"description":"Key missing, unknown or revoked."},"403":{"description":"Authenticated, but this key does not hold the required scope. The body names it."}}}},"/api/agent/messages":{"post":{"summary":"Push message history into the app's message log. For an agent that fronts a messaging channel.","security":[{"agentKey":[]}],"x-required-scope":"messages","responses":{"200":{"description":"Success."},"401":{"description":"Key missing, unknown or revoked."},"403":{"description":"Authenticated, but this key does not hold the required scope. The body names it."}}}},"/api/agent/lookup":{"get":{"summary":"Resolve ?phone= to a user and organization. Only useful to an agent that must match inbound numbers to accounts.","security":[{"agentKey":[]}],"x-required-scope":"identity:read","responses":{"200":{"description":"Success."},"401":{"description":"Key missing, unknown or revoked."},"403":{"description":"Authenticated, but this key does not hold the required scope. The body names it."}}}},"/api/agent/openapi":{"get":{"summary":"This contract as an OpenAPI 3.1 document, including every tool's argument schema. Public — no key needed.","security":[],"responses":{"200":{"description":"Success."}}}}}}