| 1 | package Claude::Agent; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use 5.020; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 6 | our @EXPORT_OK = qw(query tool create_sdk_mcp_server session); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use Claude::Agent::Query; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use Claude::Agent::Options; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use Claude::Agent::Message; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use Claude::Agent::Content; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 6 | ▶ | use Claude::Agent::Error; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 6 | our $VERSION = '0.15'; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | sub query { | ||||||||||||||||||||||||||
|
Subroutine
query: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 19 | 2 | my (%args) = @_; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | my $prompt = $args{prompt}; | |||||||||||||||||||||||||||
| 22 | 2 | ▶ | Claude::Agent::Error->throw( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $prompt and length $prompt
MC/DC50%1/2
defined $prompt and length $prompt
defined $prompt
length $prompt
Truth table66%2/3
A and B
A= defined $promptB= length $prompt
| |||||||||||||||||||||||||||||
| 23 | message => "query() requires a 'prompt' argument" | ||||||||||||||||||||||||||||
| 24 | ) unless defined $prompt && length $prompt; | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 1 | my $options = _options($args{options}); | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | return Claude::Agent::Query->new( | ||||||||||||||||||||||||||||
| 29 | prompt => $prompt, | ||||||||||||||||||||||||||||
| 30 | options => $options, | ||||||||||||||||||||||||||||
| 31 | 1 | ▶ | ($args{loop} ? (loop => $args{loop}) : ()), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 9 | ▶ | sub tool { | ||||||||||||||||||||||||||
|
Subroutine
tool: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 9 | my ($name, $description, $input_schema, $handler) = @_; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 9 | ▶ | Claude::Agent::Error->throw( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $name and length $name
MC/DC0%0/2
defined $name and length $name
defined $name
length $name
Truth table33%1/3
A and B
A= defined $nameB= length $name
| |||||||||||||||||||||||||||||
| 39 | message => "tool() requires a name argument" | ||||||||||||||||||||||||||||
| 40 | ) unless defined $name && length $name; | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 9 | ▶ | Claude::Agent::Error->throw( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | message => "tool() requires a description argument" | ||||||||||||||||||||||||||||
| 44 | ) unless defined $description; | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 9 | ▶ | Claude::Agent::Error->throw( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | message => "tool() requires an input_schema hashref" | ||||||||||||||||||||||||||||
| 48 | ) unless ref $input_schema eq 'HASH'; | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 9 | ▶ | Claude::Agent::Error->throw( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | message => "tool() requires a handler coderef" | ||||||||||||||||||||||||||||
| 52 | ) unless ref $handler eq 'CODE'; | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 9 | require Claude::Agent::MCP; | |||||||||||||||||||||||||||
| 55 | 9 | return Claude::Agent::MCP::ToolDefinition->new( | |||||||||||||||||||||||||||
| 56 | name => $name, | ||||||||||||||||||||||||||||
| 57 | description => $description, | ||||||||||||||||||||||||||||
| 58 | input_schema => $input_schema, | ||||||||||||||||||||||||||||
| 59 | handler => $handler, | ||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 4 | ▶ | sub create_sdk_mcp_server { | ||||||||||||||||||||||||||
|
Subroutine
create_sdk_mcp_server: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 64 | 4 | my (%args) = @_; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 4 | require Claude::Agent::MCP; | |||||||||||||||||||||||||||
| 67 | 4 | return Claude::Agent::MCP::Server->new(%args); | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 2 | ▶ | sub session { | ||||||||||||||||||||||||||
|
Subroutine
session: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 71 | 2 | my (%args) = @_; | |||||||||||||||||||||||||||
| 72 | 2 | require Claude::Agent::Client; | |||||||||||||||||||||||||||
| 73 | 2 | $args{options} = _options($args{options}); | |||||||||||||||||||||||||||
| 74 | 2 | return Claude::Agent::Client->new(%args); | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 3 | ▶ | sub _options { | ||||||||||||||||||||||||||
|
Subroutine
_options: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 78 | 3 | my ($options) = @_; | |||||||||||||||||||||||||||
| 79 | 3 | ▶ | return Claude::Agent::Options->new unless defined $options; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 2 | ▶ | return Claude::Agent::Options->create(%$options) if ref $options eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 2 | return $options; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 6 | 1; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | __END__ | ||||||||||||||||||||||||||||