Skip to main content

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:

  1. Check if an API key exists before making requests
  2. Provide helpful error messages when keys are missing
  3. Use the key securely in API calls
  4. 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

  1. Fork the repository at github.com/pegboard-tools/public-tool-library

  2. 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/
  3. Add your tool files:

    • metadata.json - Tool information
    • tool.py or tool.rb - Your tool script
  4. Create metadata.json:

    {
    "name": "Your Tool Name",
    "description": "Clear description of what your tool does",
    "id": "unique-tool-id"
    }
  5. Submit a pull request with your tool

Need Help?