@airwallex/developer-mcp
Version:
MCP server for AI agents that assist developers integrating with the Airwallex platform
17 lines (16 loc) • 643 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withToolTelemetry = withToolTelemetry;
const TOOL_INVOKED_EVENT_NAME = "TOOL_INVOKED";
// Middleware that wraps around a MCP tool's execute function and logs the event using the telemetry client
function withToolTelemetry(toolName, toolExecutor, { disableTelemetry, telemetryClient, }) {
return async (args) => {
if (disableTelemetry) {
return await toolExecutor(args);
}
telemetryClient.logEvent(TOOL_INVOKED_EVENT_NAME, {
toolName: toolName,
});
return await toolExecutor(args);
};
}