Conjure.Tools (Conjure v0.1.1-alpha)

View Source

Defines tool schemas for the Claude API.

This module provides the tool definitions that should be passed to the Claude API to enable skill execution. The tools include:

  • view - Read file contents or directory listings
  • bash_tool - Execute bash commands
  • create_file - Create new files with content
  • str_replace - Replace strings in files

Example

tools = Conjure.Tools.definitions()
# Pass to Claude API request body under "tools" key

Summary

Functions

Returns the tool names that are available.

The 'bash_tool' for executing bash commands.

The 'create_file' tool for creating new files.

Returns all tool definitions for skills support.

Parses a tool_use block from Claude's response into a ToolCall.

Parses multiple tool_use blocks from a response.

The 'str_replace' tool for editing files.

Checks if a tool name is valid.

The 'view' tool for reading files and directories.

Functions

available_tool_names()

@spec available_tool_names() :: [String.t()]

Returns the tool names that are available.

bash_tool()

@spec bash_tool() :: map()

The 'bash_tool' for executing bash commands.

create_file_tool()

@spec create_file_tool() :: map()

The 'create_file' tool for creating new files.

definitions(opts \\ [])

@spec definitions(keyword()) :: [map()]

Returns all tool definitions for skills support.

Options

  • :only - List of tool names to include (default: all)
  • :except - List of tool names to exclude

parse_tool_use(block)

@spec parse_tool_use(map()) :: {:ok, Conjure.ToolCall.t()} | {:error, term()}

Parses a tool_use block from Claude's response into a ToolCall.

parse_tool_uses(blocks)

@spec parse_tool_uses([map()]) :: [Conjure.ToolCall.t()]

Parses multiple tool_use blocks from a response.

str_replace_tool()

@spec str_replace_tool() :: map()

The 'str_replace' tool for editing files.

valid_tool?(name)

@spec valid_tool?(String.t()) :: boolean()

Checks if a tool name is valid.

view_tool()

@spec view_tool() :: map()

The 'view' tool for reading files and directories.