/** * @fileoverview `brapi_submit_observations` — submit new or updated * observations for a study. Two-phase write: `mode: 'preview'` validates rows * against the study's observation variables and returns a routing breakdown * (POST for new rows, PUT for rows carrying `observationDbId`); `mode: 'apply'` * elicits confirmation when supported, fans the rows out to POST + PUT in * parallel, then verifies the post-state with a cheap `pageSize=1` count. * Additive write — no observation is destroyed by this tool. * * @module mcp-server/tools/definitions/brapi-submit-observations.tool */ import { z } from '@cyanheads/mcp-ts-core'; import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors'; export declare const brapiSubmitObservations: import("@cyanheads/mcp-ts-core").ToolDefinition; studyDbId: z.ZodString; observations: z.ZodArray; observationUnitDbId: z.ZodString; observationVariableDbId: z.ZodString; value: z.ZodString; collector: z.ZodOptional; observationTimeStamp: z.ZodOptional; season: z.ZodOptional; year: z.ZodOptional; season: z.ZodOptional; }, z.core.$strip>>; geoCoordinates: z.ZodOptional; geometry: z.ZodObject<{ type: z.ZodLiteral<"Point">; coordinates: z.ZodArray; }, z.core.$strip>; }, z.core.$strip>>; }, z.core.$strip>>; mode: z.ZodDefault>; force: z.ZodDefault; }, z.core.$strip>, z.ZodObject<{ alias: z.ZodString; result: z.ZodDiscriminatedUnion<[z.ZodObject<{ mode: z.ZodLiteral<"preview">; studyDbId: z.ZodString; studyName: z.ZodOptional; valid: z.ZodNumber; invalid: z.ZodNumber; routing: z.ZodObject<{ postCount: z.ZodNumber; putCount: z.ZodNumber; }, z.core.$strip>; perRowWarnings: z.ZodArray; observationUnitDbId: z.ZodOptional; warning: z.ZodString; }, z.core.$strip>>; knownVariableCount: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ mode: z.ZodLiteral<"apply">; studyDbId: z.ZodString; studyName: z.ZodOptional; posted: z.ZodArray; observationUnitDbId: z.ZodOptional; observationVariableDbId: z.ZodOptional; value: z.ZodOptional; }, z.core.$strip>>; updated: z.ZodArray; observationVariableDbId: z.ZodOptional; value: z.ZodOptional; }, z.core.$strip>>; studyObservationCount: z.ZodOptional; latestObservationTimestamp: z.ZodOptional; perRowWarnings: z.ZodArray; observationUnitDbId: z.ZodOptional; warning: z.ZodString; }, z.core.$strip>>; warnings: z.ZodOptional>; }, z.core.$strip>], "mode">; }, z.core.$strip>, readonly [{ readonly reason: "unknown_alias"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "No connection has been registered under the requested alias"; readonly recovery: "Run brapi_connect with this alias (or omit `alias` to use the default connection) before calling brapi_submit_observations."; }, { readonly reason: "observations_unsupported"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "BrAPI server does not advertise /observations"; readonly recovery: "Run brapi_server_info to inspect the advertised endpoints, or call brapi_connect with a different alias for a server that exposes /observations."; }, { readonly reason: "study_not_found"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "Upstream returned no study record for the requested studyDbId"; readonly recovery: "Verify the studyDbId on the target server, or run brapi_find_studies to discover valid IDs before retrying."; }, { readonly reason: "post_unsupported"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "Server does not advertise POST on /observations but new rows were submitted"; readonly recovery: "Remove the rows that lack observationDbId (those are the new rows) before retrying, or connect to a different server that supports POST on /observations."; }, { readonly reason: "put_unsupported"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "Server does not advertise PUT on /observations but update rows were submitted"; readonly recovery: "Connect to a different server that supports PUT on /observations — dropping observationDbId would route as POST and create duplicates instead of updating the existing rows."; }, { readonly reason: "elicit_unavailable"; readonly code: JsonRpcErrorCode.Forbidden; readonly when: "Apply mode invoked but client does not expose ctx.elicit and force was false"; readonly recovery: "Set force=true only with explicit user authorization, or use a client that supports elicitation."; }, { readonly reason: "user_declined"; readonly code: JsonRpcErrorCode.Forbidden; readonly when: "User declined the elicitation prompt for the apply write"; readonly recovery: "Re-run the tool when the user is ready to confirm the write."; }], undefined>; //# sourceMappingURL=brapi-submit-observations.tool.d.ts.map