Documentation
¶
Overview ¶
Package scriptfail reads a managed script's failed tool call the way the tool classified it (#2032): whose problem the failure is, whether the next run is expected to pass, the sentence a person reads that in, whether the host may issue the call again, and the envelope a script asking for its failures back (on_error = "return") is handed. mcp-trino's trino_query and trino_execute classify every failure in structuredContent.error; the classification is read from that envelope and never from the message text. Extracted from internal/platform/scriptrun, which holds the interpreter and its bindings, for its size budget.
Index ¶
Constants ¶
const ( // OnErrorRaise ends the run on a failed call: the default. OnErrorRaise = "raise" // OnErrorReturn hands a failed call back to the script as data. OnErrorReturn = "return" )
The values platform.query, platform.execute and platform.call take for on_error.
Variables ¶
This section is empty.
Functions ¶
func Classify ¶
Classify reads a failed call's envelope: a failure its tool classified as retryable ends the run as the upstream's (cause upstream, retryable), and any classified failure carries the sentence describing it. A failure the tool did not classify, and one already attributed, is returned unchanged.
func Detail ¶
Detail names what the upstream reported: Trino's error type and name and the SQLSTATE a connector passed through, or how the connection failed.
func Envelope ¶
Envelope is the failure a script that asked for it is handed: the tool's error envelope, with code, message and retryable always present; false when err is not a failed tool call. A call whose upstream did not answer is retryable whatever its envelope says, as the run it would have ended is.
func OnError ¶
OnError reads a binding's on_error= argument: true when a failed call is to be returned to the script rather than end the run.
func Retries ¶
func Retries(refusal *scriptsession.RefusalError) bool
Retries reports whether the host may issue a read again after this refusal: its tool reported the failure as temporary, and the upstream itself said so. A failure to reach the upstream at all (transport) is not issued again, because the Trino client has already retried the connection for up to its own limit before reporting it (txn2/mcp-trino#106).
Types ¶
This section is empty.