sentry_finish_transaction
Complete a transaction in Sentry by setting its final status, enabling performance monitoring and error tracking for application health.
Instructions
Finish the current transaction
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "sentry_finish_transaction"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Transaction status | ok |
Implementation Reference
- src/index.ts:879-897 (handler)The handler function that executes the sentry_finish_transaction tool. It checks if there is an active transaction, ends it using currentTransaction.end(), clears the global currentTransaction variable, and returns a confirmation message.
case "sentry_finish_transaction": { const { status = "ok" } = args as any; if (!currentTransaction) { throw new Error("No active transaction to finish"); } currentTransaction.end(); currentTransaction = null; return { content: [ { type: "text", text: `Transaction finished with status: ${status}`, }, ], }; } - src/index.ts:282-296 (registration)The registration of the sentry_finish_transaction tool in the ListTools response, including its name, description, and input schema definition.
{ name: "sentry_finish_transaction", description: "Finish the current transaction", inputSchema: { type: "object", properties: { status: { type: "string", description: "Transaction status", enum: ["ok", "cancelled", "unknown", "invalid_argument", "deadline_exceeded", "not_found", "already_exists", "permission_denied", "resource_exhausted", "failed_precondition", "aborted", "out_of_range", "unimplemented", "internal_error", "unavailable", "data_loss", "unauthenticated"], default: "ok", }, }, }, }, - src/index.ts:706-706 (helper)Global variable used to store the current Sentry transaction, shared between start_transaction and finish_transaction tools.
let currentTransaction: any | null = null;