| 1 | package Langertha::Raider::ToolArgs; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Internal check of a tool call's arguments against the tool's inputSchema | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 98 | our $VERSION = '0.503'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 98 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 98 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 98 | ▶ | use JSON::MaybeXS qw( is_bool ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 98 | ▶ | use Scalar::Util qw( blessed looks_like_number ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 98 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 98 | our @EXPORT_OK = qw( tool_args_problems ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 88 | ▶ | sub tool_args_problems { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tool_args_problems: called CC=26 SCAR=32.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 88 | my ( $schema, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 88 | ▶ | return unless ref $schema eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 87 | my $explicit_object = _type_includes($schema->{type}, 'object'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 87 | ▶ | return if defined $schema->{type} && !$explicit_object; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $$schema{"type"} and not $explicit_object
MC/DC100%2/2
defined $$schema{"type"} and not $explicit_object
defined $$schema{"type"}
not $explicit_object
Truth table100%3/3
A and not(B)
A= defined $$schema{"type"}B= not $explicit_object
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 86 | ▶ | $args //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args //= {}
MC/DC100%1/1
$args //= {}
$args
Truth table100%2/2
A
A= $args
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 86 | ▶ | unless (ref $args eq 'HASH' && !blessed $args) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $args eq "HASH" and not builtin::blessed($args)
MC/DC50%1/2
ref $args eq "HASH" and not builtin::blessed($args)
ref $args eq "HASH"
not builtin::blessed($args)
Truth table66%2/3
A and not(B)
A= ref $args eq "HASH"B= not builtin::blessed($args)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | return $explicit_object ? ( 'arguments must be an object, got '._type_of($args) ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 84 | my ( @problems, %required ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 84 | ▶ | if (ref $schema->{required} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 71 | for my $key (@{$schema->{required}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 71 | ▶ | next if !defined $key || ref $key; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $key or ref $key
MC/DC0%0/2
not defined $key or ref $key
not defined $key
ref $key
Truth table33%1/3
not(A) or B
A= not defined $keyB= ref $key
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 71 | $required{$key} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 71 | ▶ | push @problems, "missing required property '".$key."'" unless exists $args->{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 84 | my $properties = $schema->{properties}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 84 | ▶ | return @problems unless ref $properties eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 82 | for my $key (sort keys %$args) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 106 | my $prop = $properties->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 106 | ▶ | next unless ref $prop eq 'HASH' && defined $prop->{type}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $prop eq "HASH" and defined $$prop{"type"}
MC/DC100%2/2
ref $prop eq "HASH" and defined $$prop{"type"}
ref $prop eq "HASH"
defined $$prop{"type"}
Truth table100%3/3
A and B
A= ref $prop eq "HASH"B= defined $$prop{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 98 | my $value = $args->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 98 | ▶ | next if !defined $value && !$required{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $value or $required{$key}
MC/DC100%2/2
defined $value or $required{$key}
defined $value
$required{$key}
Truth table100%3/3
A or B
A= defined $valueB= $required{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 94 | ▶ | my @types = ref $prop->{type} eq 'ARRAY' ? @{$prop->{type}} : ( $prop->{type} ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 94 | my $known = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 94 | my $match = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 94 | for my $type (@types) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 95 | ▶ | next if ref $type; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 95 | ▶ | my $check = _type_check($type) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 94 | $known = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 94 | ▶ | if ($check->($value)) { $match = 1; last } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 94 | ▶ | next if $match || !$known; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$match or not $known
MC/DC100%2/2
$match or not $known
$match
not $known
Truth table100%3/3
A or not(B)
A= $matchB= not $known
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 15 | push @problems, "property '".$key."' must be ".join(' or ', grep { !ref } @types) | |||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | .', got '._type_of($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 82 | return @problems; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # True when the schema's type (a name or a list of names) includes $want. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 87 | ▶ | sub _type_includes { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_type_includes: called CC=8 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 87 | my ( $type, $want ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 87 | ▶ | return 0 unless defined $type; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 85 | ▶ | return ( grep { defined && !ref && $_ eq $want } @$type ) ? 1 : 0 if ref $type eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
defined $_ && !ref($_) && $_ eq $want
defined $_ and not ref $_
MC/DC0%0/3
defined $_ && !ref($_) && $_ eq $want
defined $_
not ref $_
$_ eq $want
Truth table0%0/4
A and not(B) && C
A= defined $_B= not ref $_C= $_ eq $want
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 85 | ▶ | return !ref $type && $type eq $want ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not ref $type and $type eq $want
MC/DC50%1/2
not ref $type and $type eq $want
not ref $type
$type eq $want
Truth table66%2/3
not(A) and B
A= not ref $typeB= $type eq $want
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # A plain scalar: defined, no reference, no JSON boolean. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 85 | ▶ | sub _plain_scalar { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_plain_scalar: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 85 | my ( $v ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 85 | ▶ | return defined $v && !ref $v && !is_bool($v); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
defined $v && !ref($v) && !is_bool($v)
defined $v and not ref $v
MC/DC66%2/3
defined $v && !ref($v) && !is_bool($v)
defined $v
not ref $v
!is_bool($v)
Truth table75%3/4
A and not(B) && not(C)
A= defined $vB= not ref $vC= !is_bool($v)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 24 | ▶ | sub _number { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_number: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 24 | my ( $v ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 24 | ▶ | return _plain_scalar($v) && looks_like_number($v) && $v == $v && $v !~ /\A\s*[-+]?inf/i; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition77%7/9
_plain_scalar($v) && &looks_like_number($v) && $v == $v && !($v =~ /\A\s*[-+]?inf/i)
_plain_scalar($v) and &looks_like_number($v) and $v == $v
_plain_scalar($v) and &looks_like_number($v)
MC/DC50%2/4
_plain_scalar($v) && &looks_like_number($v) && $v == $v && !($v =~ /\A\s*[-+]?inf/i)
_plain_scalar($v)
&looks_like_number($v)
$v == $v
!($v =~ /\A\s*[-+]?inf/i)
Truth table60%3/5
A and B and C && not(D)
A= _plain_scalar($v)B= &looks_like_number($v)C= $v == $vD= !($v =~ /\A\s*[-+]?inf/i)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | my %TYPE_CHECK = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 58 | ▶ | string => sub { _plain_scalar($_[0]) }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 13 | ▶ | number => sub { _number($_[0]) }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 11 | ▶ | integer => sub { _number($_[0]) && $_[0] == int $_[0] }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 4 | ▶ | boolean => sub { is_bool($_[0]) || ( _plain_scalar($_[0]) && $_[0] =~ /\A[01]\z/ ) }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
Condition83%5/6
is_bool($_[0]) || _plain_scalar($_[0]) && $_[0] =~ /\A[01]\z/
_plain_scalar($_[0]) and $_[0] =~ /\A[01]\z/
MC/DC66%2/3
is_bool($_[0]) || _plain_scalar($_[0]) && $_[0] =~ /\A[01]\z/
is_bool($_[0])
_plain_scalar($_[0])
$_[0] =~ /\A[01]\z/
Truth table75%3/4
A || B and C
A= is_bool($_[0])B= _plain_scalar($_[0])C= $_[0] =~ /\A[01]\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 3 | ▶ | object => sub { ref $_[0] eq 'HASH' }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 4 | ▶ | array => sub { ref $_[0] eq 'ARRAY' }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | ▶ | null => sub { !defined $_[0] }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 98 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 95 | ▶ | sub _type_check { $TYPE_CHECK{$_[0]} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_type_check: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # The JSON type name of a decoded value, for the message. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 16 | ▶ | sub _type_of { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_type_of: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 16 | my ( $v ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 16 | ▶ | return !defined $v ? 'null' | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | : is_bool($v) ? 'boolean' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | : ref $v eq 'HASH' ? 'object' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | : ref $v eq 'ARRAY' ? 'array' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | : ref $v ? lc ref $v | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | : looks_like_number($v) ? 'number' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | : 'string'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 98 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | Langertha::Raider::ToolArgs - Internal check of a tool call's arguments against the tool's inputSchema | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | version 0.503 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | B<Internal module.> Its interface may change without notice. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | The C<validate> step of the one execution path every tool call of a raid | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | takes (ADR 0005): before a tool runs, its arguments are held against the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | C<inputSchema> the model was shown. Only what is clearly wrong is reported -- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | a C<required> key that is missing, or a top-level property whose value does | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | not have the C<type> the schema names. Everything JSON Schema says beyond that | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | (C<enum>, C<additionalProperties>, nested schemas, C<anyOf>, formats, ...) is | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | not checked here: the tool itself still answers for it. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | It stays lenient where Perl cannot tell or the model's slip does no harm: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | =item * A numeric string passes as C<number> / C<integer> (C<"5"> for an | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | integer), and a number passes as C<string>. Perl tools coerce either way, and | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | after any numeric use a Perl scalar no longer says which one it was. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | =item * C<0> / C<1> pass as C<boolean>, as Perl code writes booleans. The | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | strings C<"true"> / C<"false"> do not: C<"false"> is true in Perl. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | =item * C<null> for a property that is not C<required> counts as absent. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | =item * No schema, a schema whose C<type> is not C<object>, a property | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | without C<type>, and a type name not listed below: nothing is checked. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | =head2 tool_args_problems | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | my @problems = tool_args_problems($input_schema, $arguments); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | Returns one message per violation, C<required> keys first (in schema order), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | then property types (by name); the empty list when the arguments pass. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | C<undef> arguments count as C<{}>. Known types: C<string>, C<number>, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | C<integer>, C<boolean>, C<object>, C<array>, C<null>, also as a list | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | (C<< type => [ 'string', 'null' ] >>). | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | =head2 Issues | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | Please report bugs and feature requests on GitHub at | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | L<https://github.com/Getty/langertha-raider/issues>. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | =head2 IRC | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | Join C<#langertha> on C<irc.perl.org> or message Getty directly. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | =head1 CONTRIBUTING | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | This software is copyright (c) 2026 by Torsten Raudssus. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||