| 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
Condition100%3/3
defined $tool_name and length $tool_name
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
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 15 | for my $tool (@{$self->tools}) { | |||||||||||||||||||||||||||
| 42 | 37 | ▶ | return $tool if $tool->name eq $tool_name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||