Save New Tool to Library

🔧 Utility javascript node_js v2 📊 Used 3 times 🌐 floworkos.com Updated

Template dan format lengkap untuk save tool baru. 1 tool = 1 aksi atomic. Berisi contoh tool browser yang terisi lengkap — AI wajib ikuti pola ini.

Runtime Environment

  • Runtime: node_js
  • Platform: floworkos.com
  • Last Verified: 2026-04

Pre-Conditions

  • Task sudah selesai dan sukses
  • Kode sudah terbukti jalan

⚡ Executable Code

// ═══ TEMPLATE SAVE TOOL — AI WAJIB IKUTI POLA INI ═══
// Runtime: engine_action
// RULES: 1 tool = 1 aksi atomic kecil

// CONTOH TOOL BROWSER YANG BENAR DAN LENGKAP:
{
  "action": "tools_save",
  "tool": {
    "id": "tool-tiktok-fill-caption",
    "name": "TikTok Fill Caption",
    "description": "Isi caption/deskripsi di form upload TikTok. Support teks biasa dan hashtag.",
    "category": "browser",
    "language": "javascript",
    "runtime": "browser_script",
    "platform": "tiktok.com",
    "platform_version": "2026-04",
    "tags": ["tiktok", "caption", "upload", "fill", "text", "hashtag"],
    "selectors": {
      "caption_editor": ".public-DraftEditor-content",
      "caption_fallback": "[data-e2e='caption-editor']",
      "caption_div": "div[contenteditable='true']"
    },
    "code": "// TikTok Fill Caption - Atomic Tool\n// Runtime: browser_script\n\nconst caption = PARAMS.caption || 'Default caption';\n\nconst selectors = [\n  '.public-DraftEditor-content',\n  '[data-e2e=\"caption-editor\"]',\n  'div[contenteditable=\"true\"]'\n];\n\nlet editor = null;\nfor (const sel of selectors) {\n  editor = document.querySelector(sel);\n  if (editor) break;\n}\n\nif (!editor) {\n  throw new Error('Caption editor not found');\n}\n\neditor.focus();\ndocument.execCommand('selectAll', false, null);\ndocument.execCommand('insertText', false, caption);\nconsole.log('[Tool] Caption filled:', caption.substring(0, 50));",
    "parameters": [
      {"name": "caption", "type": "string", "description": "Teks caption yang akan diisi termasuk hashtag"}
    ],
    "pre_conditions": [
      "Upload form sudah terbuka",
      "Video sudah di-upload/dipilih"
    ],
    "post_conditions": [
      "Caption terisi di editor",
      "Bisa dilanjutkan ke klik Publish"
    ],
    "success_indicators": [
      "document.querySelector('.public-DraftEditor-content')?.textContent.length > 0"
    ]
  },
  "change_reason": "Created from successful TikTok upload task"
}

// ═══ CONTOH TOOL PYTHON (untuk node/backend) ═══
// {
//   "action": "tools_save",
//   "tool": {
//     "id": "tool-python-resize-image",
//     "name": "Python Resize Image",
//     "description": "Resize gambar dengan Pillow. Menjaga aspect ratio.",
//     "category": "utility",
//     "language": "python",
//     "runtime": "python",
//     "tags": ["python", "image", "resize", "pillow"],
//     "code": "from PIL import Image\nimport sys\n\ndef resize(path, max_size=1080):\n    img = Image.open(path)\n    ratio = min(max_size/img.width, max_size/img.height)\n    new_size = (int(img.width*ratio), int(img.height*ratio))\n    img = img.resize(new_size, Image.LANCZOS)\n    img.save(path)\n    return new_size",
//     "parameters": [{"name": "path", "type": "string"}, {"name": "max_size", "type": "int"}],
//     "pre_conditions": ["Pillow installed", "File exists"],
//     "post_conditions": ["Image resized and saved"]
//   }
// }

// ═══ RULES WAJIB ═══
// 1. id: tool-[platform]-[action-verb] (kebab-case)
// 2. 1 tool = 1 aksi KECIL (bukan flow lengkap)
// 3. code: KODE YANG SUDAH TERBUKTI JALAN (bukan pseudocode!)
// 4. selectors: WAJIB untuk browser tools (minimal 2: primary + fallback)
// 5. pre_conditions & post_conditions: jelaskan state sebelum & sesudah
// 6. success_indicators: kode JS yang bisa dicek untuk verify sukses
// 7. tags: minimal 5 tag relevan
// 8. JANGAN include path lokal, password, atau token
// 9. Pisahkan flow panjang jadi multiple tools:
//    SALAH: tool-tiktok-upload-video (terlalu besar)
//    BENAR: tool-tiktok-click-upload + tool-tiktok-select-file + tool-tiktok-fill-caption + tool-tiktok-click-publish

Expected Result

  • Tool muncul di /tools/<id>
  • Tool bisa dicari via tools_search

Success Indicators

  • Response: status success, action created

Statistics

3Times Used
0%Success Rate
v2Version

Version History

VersionDateChanges
v2 2026-04-01 Updated with complete filled-in tool examples (browser + python) and atomic rules