Agent skill
custom-tool-builder
Create custom tools with sandboxed Python code. Use when you need to define new tools dynamically without modifying the codebase.
Install this agent skill to your Project
npx add-skill https://github.com/binome-dev/humcp/tree/main/src/tools/builder
SKILL.md
Tool Builder
Create and manage custom tools with sandboxed Python execution.
Overview
The tool builder allows you to create new tools by providing Python code that runs in a secure sandbox. Custom tools can be enabled to become first-class MCP/REST tools.
Creating a Custom Tool
result = await tool_builder_create(
name="text_processor",
description="Process text with various transformations",
parameters={
"text": {"type": "string", "description": "Input text"},
"uppercase": {"type": "boolean", "default": False}
},
code='''
def execute(text: str, uppercase: bool = False) -> dict:
result = text.upper() if uppercase else text.lower()
return {"success": True, "data": {"result": result}}
''',
category="custom"
)
Code Requirements
- Must define an
executefunction - Function must return a dict with
successanddata/errorkeys - Code runs in a sandboxed environment with limited capabilities
Testing a Custom Tool
Before enabling, test your tool:
result = await tool_builder_test(
name="text_processor",
params={"text": "Hello World", "uppercase": True}
)
# Returns: {"success": True, "data": {"tool_name": "text_processor", "result": {...}}}
Enabling/Disabling Tools
Tools are created disabled. Enable to make them available via MCP/REST:
# Enable - registers with MCP
await tool_builder_enable(name="text_processor")
# Disable - unregisters from MCP
await tool_builder_disable(name="text_processor")
Managing Custom Tools
# List all custom tools
result = await tool_builder_list()
# Get tool details
result = await tool_builder_get(name="text_processor")
# Update tool code or description
result = await tool_builder_update(
name="text_processor",
description="Updated description",
code="def execute(): return {'success': True, 'data': {}}"
)
# Delete a tool
result = await tool_builder_delete(name="text_processor")
Sandbox Environment
Allowed
- Basic Python: variables, functions, loops, conditionals
- Type constructors:
list,dict,set,str,int,float, etc. - Utility functions:
len,range,sorted,min,max,sum, etc. - Allowed imports:
json,re,math,datetime
Blocked
- File system access:
open,os,pathlib - Network access:
socket,requests,httpx - System calls:
subprocess,os.system - Dangerous builtins:
exec,eval,compile,__import__ - Module imports (except allowlist)
Execution Limits
- Timeout: 60 seconds maximum execution time
- Memory: No hard limit (Python process limit applies)
Example: JSON Transformer
await tool_builder_create(
name="json_transform",
description="Transform JSON data by extracting specific fields",
parameters={
"data": {"type": "object", "description": "Input JSON object"},
"fields": {"type": "array", "description": "Fields to extract"}
},
code='''
def execute(data: dict, fields: list) -> dict:
result = {field: data.get(field) for field in fields if field in data}
return {"success": True, "data": result}
'''
)
Example: Text Statistics
await tool_builder_create(
name="text_stats",
description="Calculate statistics about text",
parameters={
"text": {"type": "string", "description": "Input text"}
},
code='''
def execute(text: str) -> dict:
words = text.split()
return {
"success": True,
"data": {
"char_count": len(text),
"word_count": len(words),
"line_count": text.count("\\n") + 1,
"avg_word_length": sum(len(w) for w in words) / len(words) if words else 0
}
}
'''
)
Response Format
All tools return:
{
"success": true,
"data": {
"name": "my_tool",
"description": "...",
"code": "...",
"parameters": {...},
"category": "custom",
"enabled": false,
"created_at": "2026-01-03T...",
"updated_at": "2026-01-03T..."
}
}
On error:
{
"success": false,
"error": "Error description"
}
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
llm
Generate text, call tools, and get structured JSON output using LLM providers (Claude, OpenAI, Gemini, Ollama). Use when the user needs to call an LLM API for text generation, function calling, or structured data extraction.
calendar-tools
Manages calendar bookings and video conferencing. Use when the user needs to check availability, create bookings on Cal.com, or schedule and manage Zoom meetings.
http-api-client
Make HTTP requests to any URL or API endpoint. Use when the user needs to call a REST API, fetch data from a URL, send webhooks, or test HTTP endpoints. Supports GET, POST, PUT, PATCH, DELETE methods with custom headers and JSON body.
processing-data
Processes CSV files and pandas DataFrames. Use when working with CSV files, tabular data, spreadsheets, or when the user asks to query, analyze, or manipulate structured data.
persistent-memory
Store, search, and retrieve persistent memories and conversation history using Mem0 or Zep. Use when the user needs to remember facts, maintain context across sessions, or manage conversational memory.
storage
Use these tools for S3-compatible object storage operations with MinIO
Didn't find tool you were looking for?