Branch Coverage

blib/lib/MCP/Server.pm
Criterion Covered Total %
branch 60 64 93.7


line true false branch
23 0 105 unless ref $request eq "HASH"
24 0 105 unless my $method = $$request{"method"}
27 88 17 if (defined(my $id = $$request{"id"}))
30 2 86 if defined $token
32 18 70 if ($method eq 'initialize') { }
6 64 elsif ($method eq 'tools/list') { }
28 36 elsif ($method eq 'tools/call') { }
1 35 elsif ($method eq 'ping') { }
5 30 elsif ($method eq 'prompts/list') { }
13 17 elsif ($method eq 'prompts/get') { }
5 12 elsif ($method eq 'resources/list') { }
11 1 elsif ($method eq 'resources/read') { }
70 0 3 unless my $transport = $self->transport
80 1 0 if keys %scopes
114 11 7 $transport && $transport->notifications ? :
125 1 9 unless $context->has_scope(@{$prompt->scopes;})
137 2 11 unless my $prompt = &first(sub { $_->name eq $name; } , @{$self->_prompts($context);})
138 1 10 if (my $err = $self->_check_scope($prompt, $context, $id))
139 1 9 if $prompt->validate_input($args)
142 2 7 if builtin::blessed($result) and $result->isa("Mojo::Promise")
149 1 9 unless $context->has_scope(@{$resource->scopes;})
165 2 9 unless my $resource = &first(sub { $_->uri eq $uri; } , @{$self->_resources($context);})
166 1 8 if (my $err = $self->_check_scope($resource, $context, $id))
169 1 7 if builtin::blessed($result) and $result->isa("Mojo::Promise")
177 3 25 unless my $tool = &first(sub { $_->name eq $name; } , @{$self->_tools($context);})
178 2 23 if (my $err = $self->_check_scope($tool, $context, $id))
179 1 22 if $tool->validate_input($args)
182 3 19 if builtin::blessed($result) and $result->isa("Mojo::Promise")
189 1 17 unless $context->has_scope(@{$tool->scopes;})
191 1 16 if (my $output_schema = $tool->output_schema)
194 2 15 if keys %$annotations
203 41 4 if $context->has_scope(@$scopes)