NAME
Claude::Agent::MCP::ToolDefinition - MCP tool definition
DESCRIPTION
Defines a custom MCP tool.
ATTRIBUTES
name - Tool name (will be prefixed with mcp__server__)
description - Description of what the tool does
input_schema - JSON Schema defining the tool's input parameters
handler - Coderef that executes the tool
HANDLER SIGNATURE
sub handler {
my ($args) = @_;
# $args is a hashref of input parameters
# Return a result hashref:
return {
content => [
{ type => 'text', text => 'Result text' },
],
is_error => 0, # Optional, default false
};
}
METHODS
to_hash
my $hash = $tool->to_hash();
Convert the tool definition to a hash for JSON serialization.
execute
my $result = $tool->execute(\%args);
Execute the tool handler with the given arguments.
AUTHOR
LNATION, <email at lnation.org>
LICENSE
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under The Artistic License 2.0 (GPL Compatible).