Developer Guide
Technical guide for developers who want to create tools, contribute to the library, or integrate external APIs.
Tool File Structure
Every PegBoard tool consists of a folder containing two required files:
Metadata File (metadata.json
)
Required fields:
{
"name": "Your Tool Name",
"description": "Clear description of what your tool does",
"id": "unique-tool-id"
}
Tool Script File
- Blender, Rhino, Revit:
tool.py
(Python) - SketchUp:
tool.rb
(Ruby)
Example Tool Structure
my-tool/
├── metadata.json
└── tool.py (or tool.rb for SketchUp)
Using API Keys in Your Code
Once users have saved API keys in PegBoard Settings, your tools can access them using the get_api_token()
function available in all software loaders.
Python (Blender, Rhino, Revit)
# Get the API key from PegBoard settings
api_key = get_api_token("gemini_api_key")
if not api_key:
print("Error: No Gemini API key found!")
print("Please add your API key in PegBoard Settings > API Tokens")
print("Token name: gemini_api_key")
print("Get your key at: https://aistudio.google.com/app/apikey")
else:
# Use the API key in your tool
response = call_gemini_api(image_data, prompt, api_key)
Ruby (SketchUp)
# Get the API key from PegBoard settings
api_key = get_api_token("gemini_api_key")
if api_key.nil?
UI.messagebox("Error: No Gemini API key found!\n\nPlease add your API key in PegBoard Settings > API Tokens.\nToken name: gemini_api_key")
else
# Use the API key in your tool
response = call_gemini_api(image_data, prompt, api_key)
end
Complete Example: AI Integration
For a complete implementation, check out the Gemini AI Renderer tool which demonstrates:
- Capturing viewport screenshots
- Sending images to Gemini API for AI rendering
- Displaying results with save options
- Proper error handling for missing API keys
The tool shows how to:
- Check if an API key exists before making requests
- Provide helpful error messages when keys are missing
- Use the key securely in API calls
- Handle API responses and errors gracefully
Contributing to the Tool Library
Want to share your tools with the community? You can contribute to the PegBoard Tool Library on GitHub.
How to Contribute
-
Fork the repository at github.com/pegboard-tools/public-tool-library
-
Create a tool folder in the appropriate directory:
tools/{software}/{your-tool-name}/
For example:
tools/blender/array-duplicator/
tools/sketchup/wall-generator/
tools/revit/room-renamer/
-
Add your tool files:
metadata.json
- Tool informationtool.py
ortool.rb
- Your tool script
-
Create metadata.json:
{
"name": "Your Tool Name",
"description": "Clear description of what your tool does",
"id": "unique-tool-id"
} -
Submit a pull request with your tool
Need Help?
- Browse the Tool Library for examples
- Join our Discord community for developer discussions
- Check the FAQ for common questions