mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
2bd709db63
Bumps [github.com/mark3labs/mcp-go](https://github.com/mark3labs/mcp-go) from 0.37.0 to 0.43.0. - [Release notes](https://github.com/mark3labs/mcp-go/releases) - [Commits](https://github.com/mark3labs/mcp-go/compare/v0.37.0...v0.43.0) --- updated-dependencies: - dependency-name: github.com/mark3labs/mcp-go dependency-version: 0.43.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/mark3labs/mcp-go/mcp"
|
|
)
|
|
|
|
var (
|
|
// ErrNoActiveSession is returned when there is no active session in the context
|
|
ErrNoActiveSession = errors.New("no active session")
|
|
// ErrElicitationNotSupported is returned when the session does not support elicitation
|
|
ErrElicitationNotSupported = errors.New("session does not support elicitation")
|
|
)
|
|
|
|
// RequestElicitation sends an elicitation request to the client.
|
|
// The client must have declared elicitation capability during initialization.
|
|
// The session must implement SessionWithElicitation to support this operation.
|
|
func (s *MCPServer) RequestElicitation(ctx context.Context, request mcp.ElicitationRequest) (*mcp.ElicitationResult, error) {
|
|
session := ClientSessionFromContext(ctx)
|
|
if session == nil {
|
|
return nil, ErrNoActiveSession
|
|
}
|
|
|
|
// Check if the session supports elicitation requests
|
|
if elicitationSession, ok := session.(SessionWithElicitation); ok {
|
|
return elicitationSession.RequestElicitation(ctx, request)
|
|
}
|
|
|
|
return nil, ErrElicitationNotSupported
|
|
}
|