NAME

Claude::Agent::Content::ToolUse - Tool use content block

DESCRIPTION

A tool use content block representing Claude's request to use a tool.

ATTRIBUTES

type

Always tool_use. Read only.

id

Unique identifier for this tool use.

name

Name of the tool being used.

input

HashRef of input parameters for the tool.

raw

The decoded block as the CLI sent it, when the object was built by Claude::Agent::Content->from_json.

COMMON TOOL INPUTS

Different tools accept different inputs:

Read

{ file_path => '/path/to/file', offset => 0, limit => 100 }

Write

{ file_path => '/path/to/file', content => '...' }

Edit

{ file_path => '/path/to/file', old_string => '...', new_string => '...' }

Bash

{ command => '...', description => '...', timeout => 60000 }

Glob

{ pattern => '**/*.pm', path => '/path/to/search' }

Grep

{ pattern => 'search term', path => '/path/to/search' }

METHODS

new

Takes a flat list of name/value pairs. Unknown names are ignored.

is_mcp_tool

if ($block->is_mcp_tool) { ... }

True when the tool name starts with mcp__.

mcp_server

my $server = $block->mcp_server;

The server part of an MCP tool name (mcp__server__tool), or undef. The split is on the first __ after the prefix, so a tool whose own name contains __ keeps it.

mcp_tool_name

my $tool = $block->mcp_tool_name;

The tool part of an MCP tool name, or undef.

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).