mcp: validation only for accept action (#766)
Fix: #758 - validate schema only for accept action - add unit test
This commit is contained in:
parent
fe6d3cf74a
commit
b29ab52878
1 changed files with 73 additions and 1 deletions
|
|
@ -590,7 +590,7 @@ func (c *Client) elicit(ctx context.Context, req *ElicitRequest) (*ElicitResult,
|
|||
return nil, err
|
||||
}
|
||||
// Validate elicitation result content against requested schema.
|
||||
if schema != nil && res.Content != nil {
|
||||
if res.Action == "accept" && schema != nil && res.Content != nil {
|
||||
resolved, err := schema.Resolve(nil)
|
||||
if err != nil {
|
||||
return nil, &jsonrpc.Error{Code: jsonrpc.CodeInvalidParams, Message: fmt.Sprintf("failed to resolve requested schema: %v", err)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue