From tac
Generates boilerplate for custom @tool-decorated functions in Claude Agent SDK, including MCP server setup and agent config. Use when adding tools to custom agents.
npx claudepluginhub melodic-software/claude-code-plugins --plugin tacThis skill is limited to using the following tools:
Generate custom tool boilerplate with @tool decorator.
Designs custom Python tools with @tool decorator for domain-specific agents, MCP servers, and Agent SDK. Guides interface, params, logic, and error handling.
Designs AI agent tools covering JSON Schema best practices, descriptions, validation, error handling, and MCP standard for Anthropic, OpenAI, LangChain.
Builds AI agents and automates Claude Code programmatically using Python Agent SDK and headless CLI mode (claude -p). Covers MCP servers, hooks, and sessions.
Share bugs, ideas, or general feedback.
Generate custom tool boilerplate with @tool decorator.
$1: Tool name (snake_case)$ARGUMENTS: Tool description and purpose (after name)You are creating a custom tool for use in custom agents.
Extract:
$1 (required, snake_case)If no name provided, STOP and ask for tool name. If no description provided, STOP and ask for tool purpose.
Based on the tool purpose, determine:
Create tool using @tool decorator:
from typing import Any
from claude_agent_sdk import tool
@tool(
"[tool_name]",
"[Description for agent - when to use this tool]",
{
"param1": str,
"param2": int,
}
)
async def [tool_name](args: dict[str, Any]) -> dict[str, Any]:
"""
[Brief docstring]
"""
try:
# Extract parameters
param1 = args["param1"]
param2 = args.get("param2", default_value)
# Validate inputs
if not param1:
return {
"content": [{"type": "text", "text": "Error: param1 required"}],
"is_error": True
}
# Perform operation
result = perform_operation(param1, param2)
# Return success
return {
"content": [{"type": "text", "text": str(result)}]
}
except Exception as e:
return {
"content": [{"type": "text", "text": f"Error: {str(e)}"}],
"is_error": True
}
from claude_agent_sdk import create_sdk_mcp_server
# Create server with tool
[server_name]_server = create_sdk_mcp_server(
name="[server_name]",
version="1.0.0",
tools=[[tool_name]]
)
from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient
options = ClaudeAgentOptions(
mcp_servers={"[server_name]": [server_name]_server},
allowed_tools=["mcp__[server_name]__[tool_name]"],
system_prompt=system_prompt,
model="opus",
)
# IMPORTANT: Use ClaudeSDKClient for custom tools
async with ClaudeSDKClient(options=options) as client:
await client.query(prompt)
async for message in client.receive_response():
pass
## Tool Created
**Name:** [tool_name]
**Server:** [server_name]
**Tool ID:** mcp__[server_name]__[tool_name]
### Tool Definition
```python
[Generated @tool decorated function]
[Generated server setup]
[Generated configuration]
| Name | Type | Required | Description |
|---|---|---|---|
| param1 | str | Yes | [description] |
| param2 | int | No | [description], default: [value] |
Agent prompt: "[example prompt that triggers tool]" Expected call: [tool_name](param1="value", param2=10) Expected result: "[expected output]"
# Test the tool directly
result = await [tool_name]({"param1": "test", "param2": 10})
assert "content" in result
assert not result.get("is_error", False)