Agent/MCP/Server.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 4 / 4 totaltotal 100% 51 / 51 CC 5 SCAR 9.3
CC
5
Cov
100%
get_tool
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« Agent/Hook/Result.pm ↑ Summary Agent/Types.pm »
1 package Claude::Agent::MCP::Server;
2  
3 8 ▶use 5.020;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 8 ▶use Object::Proto ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
10 8 Object::Proto::define('Claude::Agent::MCP::Server',
11 'name:Str:required',
12 'tools:ArrayRef:default([])',
13 q{version:Str:default('1.0.0')},
14 'type:Str:readonly:default(sdk)',
15 );
16 }
17  
18 1 ▶sub to_hash {
Subroutine to_hash: called CC=1 SCAR=0.0
Pod documented
19 1 my ($self) = @_;
20 return {
21 type => $self->type,
22 name => $self->name,
23 version => $self->version,
24 1 tools => [ map { $_->to_hash } @{$self->tools} ],
25 };
26 }
27  
28 2 ▶sub to_cli_config {
Subroutine to_cli_config: called CC=1 SCAR=0.0
Pod documented
29 2 my ($self) = @_;
30 return {
31 2 type => 'sdk',
32 name => $self->name,
33 };
34 }
35  
36 17 ▶sub get_tool {
Subroutine get_tool: called CC=5 SCAR=16.1
Pod documented
37 17 my ($self, $tool_name) = @_;
38  
39 17 ▶ return unless defined $tool_name && length $tool_name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $tool_name and length $tool_name 2 15 17
Condition100%3/3
defined $tool_name and length $tool_name
!ll&&!rl&&r
1115
MC/DC100%2/2
defined $tool_name and length $tool_name
defined $tool_name length $tool_name
Truth table100%3/3
A and B
A= defined $tool_nameB= length $tool_name
ABresult
0X0
100
111
40  
41 15 for my $tool (@{$self->tools}) {
42 37 ▶ return $tool if $tool->name eq $tool_name;
Branch: 1 branch
BranchTrueFalseTotal
if $tool->name eq $tool_name 12 25 37
43 }
44  
45 3 return;
46 }
47  
48 1 ▶sub tool_names {
Subroutine tool_names: called CC=1 SCAR=0.0
Pod documented
49 1 my ($self) = @_;
50 1 return [ map { 'mcp__' . $self->name . '__' . $_->name } @{$self->tools} ];
51 }
52  
53 8 1;
54  
55 __END__
« Agent/Hook/Result.pm ↑ Summary Agent/Types.pm »