PTENES
MODULE 4.2

๐Ÿงฐ Skills and Tools

BaseTool, auto-discovery, Google Workspace, GitHub, and how to create custom tools.

6
Topics
60
Minutes
Interm.
Level
Hands-on
Type
1

๐Ÿ”ง BaseTool โ€” The Contract

BaseTool is the interface that makes the tool system extensible. Four Required Attributes and the LLM already knows how to use the tool.

๐Ÿ“Œ BaseTool Interface

  • โ€ขname: str โ€” unique identifier ('google_calendar')
  • โ€ขdescription: str โ€” for the LLM to decide when to use it
  • โ€ขparameters: dict โ€” JSON Schema for the arguments
  • โ€ขasync execute(**kwargs) -> str โ€” implementation
  • โ€ขregistry.py automatically discovers tools in tools/

๐Ÿ’ก Practical Tip

Write the description as if it were for an intelligent human. The LLM reads exactly this to decide when to call the tool.

2

๐Ÿ” Registry and Automatic Discovery

registry.py uses Python reflection to automatically discover all classes that extend BaseTool. No manual registration code.

๐Ÿ“Œ How Auto-Discovery Works

  • โ€ขScans all files in tools/*.py
  • โ€ขImport each module with importlib.import_module()
  • โ€ขInspects classes with inspect.getmembers()
  • โ€ขFilter for BaseTool subclasses with issubclass()
  • โ€ขInstantiates and registers in the tool_registry dict

๐Ÿ’ก Practical Tip

Put a tool in tools/ and restart Jarvis. It becomes available automatically. No need to edit Agent or manually edit the registry.

3

๐Ÿ“… Google Workspace

Google Workspace integration connects Jarvis to the world's most common productivity infrastructure. Calendar, Drive, Gmail, and Sheets in native tools.

๐Ÿ“Œ Google Workspace Tools

  • โ€ขGoogleCalendarTool: create, list, update, and cancel events
  • โ€ขGoogleDriveTool: upload, download, search, and share files
  • โ€ขGmailTool: read, send, archive, and categorize emails
  • โ€ขGoogleSheetsTool: read and write spreadsheets
  • โ€ขAuthentication: OAuth2 with automatic token refresh

๐Ÿ’ก Practical Tip

Use service accounts for automation without human interaction. For personal use, OAuth2 with a token saved in .secrets is simpler.

4

๐Ÿ™ GitHub Integration

The GitHubTool turns Jarvis into a development collaborator. Issues, PRs, commits, and code search via API.

๐Ÿ“Œ GitHub Capabilities

  • โ€ขList and create issues with labels and assignees
  • โ€ขReview PRs: view diffs, comment, approve, or request changes
  • โ€ขSearch code by default in a specific repository
  • โ€ขMake simple commits (e.g., update a config file)
  • โ€ขCheck CI/CD status on the latest commit

๐Ÿ’ก Practical Tip

Configure GITHUB_TOKEN with the minimum required scope. For read-only access, use only 'repo:read'. For write access, add the full 'repo' scope.

5

๐ŸŒ BrowserTool โ€” Web Scraping

BrowserTool uses headless Playwright to give Jarvis real-time access to the web. Search, extract, and browse with user approval.

๐Ÿ“Œ Browser Capabilities

  • โ€ขweb_search(): searches DuckDuckGo or Google with structured results
  • โ€ขfetch_page(): extracts text from any URL (with injection detection)
  • โ€ขtake_screenshot(): visual capture of pages for analysis
  • โ€ขfill_form(): fills out forms with explicit approval
  • โ€ขAll actions go through the level 2 approval gate

๐Ÿ’ก Practical Tip

Always run web page content through the injection scanner before adding it to the context. Malicious pages may contain indirect injection.

6

โšก Creating Custom Tools

The INTELECTO extension model is deliberately simple. Fewer than 50 lines to turn any API into a Jarvis tool.

๐Ÿ“Œ Tool Template in 5 Steps

  • โ€ข1. Create tools/minha_tool.py
  • โ€ข2. from intelecto.tools.base import BaseTool
  • โ€ข3. class MinhaTool(BaseTool):
  • โ€ข4. Define name, description, parameters (JSON Schema)
  • โ€ข5. async def execute(**kwargs) -> str: # your logic

๐Ÿ’ก Practical Tip

The description parameter is the most important. Write it like a function docstring: what it does, when to use it, and what it returns. The LLM reads it literally.

โœ… Module 4.2 Summary

โœ“
BaseTool โ€” The Contract โ€” 4 attributes + execute() โ€” the LLM uses description to decide when and how to call it
โœ“
Registry and Automatic Discovery โ€” Python reflection + importlib = zero-config auto-discovery
โœ“
Google Workspace โ€” Calendar, Drive, Gmail, and Sheets โ€” full integration with automatic OAuth2
โœ“
GitHub Integration โ€” Issues, PRs, commits, and code search โ€” Jarvis as a development collaborator
โœ“
BrowserTool โ€” Web Scraping โ€” Headless Playwright with a safety wrapper โ€” real web access with protection
โœ“
Creating Custom Tools โ€” 50-line template โ€” any REST API becomes a tool in minutes

Next:

4.3 Automation and Webhooks