vizra-ai/vizra-adk/vizra-tool-creation

Claude Code and agent skill by vizra-ai/vizra-adk

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Build custom tools for Vizra ADK agents - includes patterns for database, API, file, and email tools

Install

npx vskill@latest install vizra-ai/vizra-adk/vizra-tool-creation

SKILL.md

Building Vizra ADK Tools

Tools extend agent capabilities by allowing them to interact with databases, APIs, files, and external services.

Tool Class Structure

Every tool MUST implement ToolInterface:

php
<?php
namespace App\Tools;
use Vizra\VizraADK\Contracts\ToolInterface;
use Vizra\VizraADK\Agents\AgentContext;
class {{ ToolName }}Tool implements ToolInterface
{
/**
* Define the tool's schema for the LLM
*/
public function definition(): array
{
return [
'name' => '{{ tool_name }}',
'description' => '{{ What this tool does - be specific }}',
'parameters' => [
'type' => 'object',
'properties' => [
'param1' => [
'type' => 'string',
'description' => '{{ Parameter description }}'
],
'param2' => [
'type' => 'integer',
'description' => '{{ Parameter description }}'
],
],
'required' => ['param1'],
],
];
}
/**
* Execute the tool with given arguments
*/
public function execute(array $arguments, AgentContext $context): string
{
// Tool logic here
return json_encode([
'status' => 'success',
'data' => $result
]);
}
}

Key Rules

  1. Naming Convention:
  • Class name MUST end with Tool
  • The name in definition should be snake_case
  1. Definition Requirements:
  • name: Unique identifier for the tool
  • description: Clear description of what the tool does (LLM uses this to decide when to use the tool)
  • parameters: JSON Schema format describing expected inputs
  1. Return Format:
  • Always return JSON-encoded strings
  • Include status indicators for success/error
  • Provide meaningful error messages

Parameter Types

php
'parameters' => [
'type' => 'object',
'properties' => [
// String parameter
'name' => [
'type' => 'string',
'description' => 'The user name'
],
// Integer parameter
'count' => [
'type' => 'integer',
'description' => 'Number of items'
],
// Boolean parameter
'active' => [
'type' => 'boolean',
'description' => 'Whether the item is active'
],
// Enum parameter
'status' => [
'type' => 'string',
'enum' => ['pending', 'approved', 'rejected'],
'description' => 'Current status'
],
// Array parameter
'tags' => [
'type' => 'array',
'items' => ['type' => 'string'],
'description' => 'List of tags'
],
// Object parameter
'metadata' => [
'type' => 'object',
'properties' => [
'key' => ['type' => 'string'],
'value' => ['type' => 'string']
],
'description' => 'Additional metadata'
],
],
'required' => ['name', 'count'],
]

Common Tool Patterns

Database Query Tool
php
class DatabaseQueryTool implements ToolInterface
{
public function definition(): array
{
return [
'name' => 'query_database',
'description' => 'Execute a read-only database query to retrieve information',
'parameters' => [
'type' => 'object',
'properties' => [
'table' => [
'type' => 'string',
'description' => 'The table to query'
],
'conditions' => [
'type' => 'object',
'description' => 'WHERE conditions as key-value pairs'
],
'limit' => [
'type' => 'integer',
'description' => 'Maximum number of results'
],
],
'required' => ['table'],
],
];
}
public function execute(array $arguments, AgentContext $context): string
{
$allowedTables = ['users', 'orders', 'products'];
if (!in_array($arguments['table'], $allowedTables)) {
return json_encode([
'status' => 'error',
'message' => 'Table not allowed'
]);
}
$query = DB::table($arguments['table']);
if (isset($arguments['conditions'])) {
foreach ($arguments['conditions'] as $key => $value) {
$query->where($key, $value);
}
}
$results = $query->limit($arguments['limit'] ?? 10)->get();
return json_encode([
'status' => 'success',
'data' => $results,
'count' => $results->count()
]);
}
}
API Integration Tool
php
class ExternalApiTool implements ToolInterface
{
public function definition(): array
{
return [
'name' => 'call_external_api',
'description' => 'Make requests to the external service API',
'parameters' => [
'type' => 'object',
'properties' => [
'endpoint' => [
'type' => 'string',
'description' => 'API endpoint path'
],
'method' => [
'type' => 'string',
'enum' => ['GET', 'POST'],
'description' => 'HTTP method'
],
'data' => [
'type' => 'object',
'description' => 'Request payload for POST requests'
],
],
'required' => ['endpoint', 'method'],
],
];
}
public function execute(array $arguments, AgentContext $context): string
{
try {
$response = Http::withToken(config('services.external.api_key'))
->baseUrl(config('services.external.base_url'))
->{strtolower($arguments['method'])}(
$arguments['endpoint'],
$arguments['data'] ?? []
);
return json_encode([
'status' => 'success',
'data' => $response->json(),
'http_status' => $response->status()
]);
} catch (\Exception $e) {
return json_encode([
'status' => 'error',
'message' => $e->getMessage()
]);
}
}
}
File Operations Tool
php
class FileOperationsTool implements ToolInterface
{
public function definition(): array
{
return [
'name' => 'file_operations',
'description' => 'Read or write files in the allowed storage directory',
'parameters' => [
'type' => 'object',
'properties' => [
'operation' => [
'type' => 'string',
'enum' => ['read', 'write', 'list'],
'description' => 'Operation to perform'
],
'path' => [
'type' => 'string',
'description' => 'File path relative to storage'
],
'content' => [
'type' => 'string',
'description' => 'Content to write (for write operation)'
],
],
'required' => ['operation', 'path'],
],
];
}
public function execute(array $arguments, AgentContext $context): string
{
// Sanitize path to prevent directory traversal
$safePath = str_replace(['..', '//'], '', $arguments['path']);
$fullPath = storage_path('app/agent-files/' . $safePath);
switch ($arguments['operation']) {
case 'read':
if (!file_exists($fullPath)) {
return json_encode(['status' => 'error', 'message' => 'File not found']);
}
return json_encode([
'status' => 'success',
'content' => file_get_contents($fullPath)
]);
case 'write':
file_put_contents($fullPath, $arguments['content'] ?? '');
return json_encode(['status' => 'success', 'message' => 'File written']);
case 'list':
$files = glob($fullPath . '/*');
return json_encode([
'status' => 'success',
'files' => array_map('basename', $files)
]);
}
}
}
Email Tool
php
class EmailTool implements ToolInterface
{
public function definition(): array
{
return [
'name' => 'send_email',
'description' => 'Send an email to a recipient',
'parameters' => [
'type' => 'object',
'properties' => [
'to' => [
'type' => 'string',
'description' => 'Recipient email address'
],
'subject' => [
'type' => 'string',
'description' => 'Email subject line'
],
'body' => [
'type' => 'string',
'description' => 'Email body content'
],
],
'required' => ['to', 'subject', 'body'],
],
];
}
public function execute(array $arguments, AgentContext $context): string
{
try {
// Validate email
if (!filter_var($arguments['to'], FILTER_VALIDATE_EMAIL)) {
return json_encode([
'status' => 'error',
'message' => 'Invalid email address'
]);
}
Mail::raw($arguments['body'], function ($message) use ($arguments) {
$message->to($arguments['to'])
->subject($arguments['subject']);
});
return json_encode([
'status' => 'success',
'message' => 'Email sent successfully'
]);
} catch (\Exception $e) {
return json_encode([
'status' => 'error',
'message' => 'Failed to send email: ' . $e->getMessage()
]);
}
}
}

Error Handling Best Practices

php
public function execute(array $arguments, AgentContext $context): string
{
try {
// Validate inputs
if (empty($arguments['required_field'])) {
return json_encode([
'status' => 'error',
'error_type' => 'validation',
'message' => 'required_field is missing'
]);
}
// Perform operation
$result = $this->performOperation($arguments);
return json_encode([
'status' => 'success',
'data' => $result
]);
} catch (\InvalidArgumentException $e) {
return json_encode([
'status' => 'error',
'error_type' => 'validation',
'message' => $e->getMessage()
]);
} catch (\Exception $e) {
Log::error('Tool execution failed', [
'tool' => static::class,
'error' => $e->getMessage()
]);

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
291
Repository forks
36
7-day trend score
28

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/vizra-ai/vizra-adk/vizra-tool-creation/badge)](https://verified-skill.com/skills/vizra-ai/vizra-adk/vizra-tool-creation)

Something wrong with this skill or its page? Tell us.