-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
enhancementNew feature or requestNew feature or request
Description
When interacting with an mcp server from the client, the tool entrypoint should be auto-observed by opentelemetry (if its present), like we do with REST endpoints.
Even if I manually add tracing, like this for example, the spans do not correlate with the caller.
Also, if I add the @WithSpan annotation then things blow up.
@Tool(name = "sendEmail", value = "Sends an email")
public ToolResponse sendEmail(Email email) {
var span = this.tracer.spanBuilder("sendEmail")
.setAttribute("arg.email", email.toString())
.setParent(Context.current().with(Span.current()))
.setSpanKind(SpanKind.SERVER)
.startSpan();
try {
var mail = Mail.withText(email.to(), email.subject(), email.body())
.setFrom(email.from());
this.mailer.send(mail);
return ToolResponse.success("Email successfully sent");
}
finally {
span.end();
}
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request