[
{
type: "function",
function: {
name: "read_file",
description: "Read the content of a file under the project root. " \
"Optional start_line and end_line (1-based, inclusive) return only that slice.",
parameters: {
type: "object",
properties: {
path: { type: "string" },
start_line: { type: "integer", description: "First line to include (1-based)" },
end_line: { type: "integer", description: "Last line to include (1-based); omit through EOF" }
},
required: ["path"]
}
}
},
{
type: "function",
function: {
name: "search_code",
description: "Search: mode text = ripgrep/grep (default). " \
"Modes class, module, constant, method = Prism Ruby index (no grep).",
parameters: {
type: "object",
properties: {
pattern: { type: "string" },
directory: { type: "string" },
mode: {
type: "string",
description: "text (default), class, module, constant, or method (Prism Ruby index)"
}
},
required: ["pattern"]
}
}
},
{
type: "function",
function: {
name: "list_files",
description: "List file paths under a directory relative to project root (skips .git). " \
"Use first to see layout (lib/, exe/, gemspec) before updating README or docs.",
parameters: {
type: "object",
properties: {
directory: { type: "string", description: "Directory to scan (default: .)" },
max_entries: { type: "integer", description: "Max paths to return (default 100, max 500)" },
max_depth: {
type: "integer",
description: "Optional max path depth under directory (omit = unlimited; 1 = immediate children only)"
}
},
required: []
}
}
},
{
type: "function",
function: {
name: "edit_file",
description: "Apply a unified diff to the file given by path. " \
"Use git unified format: --- a/<path>, then +++ b/<path>, then @@ hunk, then lines with " \
"leading space, `-`, or `+`. Copy exact lines from read_file; @@ counts must match the " \
"hunk. Paths in ---/+++ must match path. patch -p1 from project root.",
parameters: {
type: "object",
properties: {
path: { type: "string" },
diff: { type: "string" }
},
required: %w[path diff]
}
}
},
{
type: "function",
function: {
name: "write_file",
description: "Create or overwrite a file under the project root with full UTF-8 content. " \
"Use for new files or complete rewrites. Prefer edit_file for surgical changes.",
parameters: {
type: "object",
properties: {
path: { type: "string", description: "File path relative to project root" },
content: { type: "string", description: "Full file content to write" }
},
required: %w[path content]
}
}
},
{
type: "function",
function: {
name: "list_directory_contents",
description: "Inspect files and folders inside the current workspace. " \
"Use this to see what actually exists before answering questions about local files.",
parameters: {
type: "object",
properties: {
path: {
type: "string",
description: "Relative path inside the workspace, e.g. '.', 'lib', or 'spec/unit'. " \
"Defaults to the workspace root."
}
},
required: []
}
}
},
{
type: "function",
function: {
name: "calculate",
description: "Evaluate an arithmetic expression and return the numeric result. " \
"Supports +, -, *, /, ** (power) and parentheses. " \
"Use for precise computation rather than mental arithmetic.",
parameters: {
type: "object",
properties: {
expression: {
type: "string",
description: "Arithmetic expression, e.g. '(12 + 8) / 5' or '2 ** 10'"
}
},
required: ["expression"]
}
}
}
].freeze
{
type: "function",
function: {
name: "delegate_to_agent",
description: "Run a task via an external CLI agent (non-interactive argv only). Use after " \
"list_external_agents; pass a concise task and context_summary; prefer exploring the repo " \
"with read_file/search_code first to save tokens.",
parameters: {
type: "object",
properties: {
agent_id: { type: "string", description: "Registry id (e.g. claude_cli, gemini_cli)" },
task: { type: "string", description: "What the external agent should do" },
context_summary: { type: "string", description: "Short context from your own exploration" },
paths: {
type: "array",
items: { type: "string" },
description: "Optional relative paths under project root to mention in the handoff"
},
timeout_seconds: {
type: "integer",
description: "Optional timeout (defaults from registry or 600)"
}
},
required: %w[agent_id task]
}
}
}.freeze