Ectomancer.ObanBridge (Ectomancer v1.2.1)

Copy Markdown View Source

Oban integration for Ectomancer.

This module provides the expose_oban_jobs/0 and expose_oban_jobs/1 macros that automatically generate MCP tools for managing Oban job queues.

Usage

defmodule MyApp.MCP do
  use Ectomancer

  # Expose all Oban job management tools
  expose_oban_jobs

  # Or with namespace prefix
  expose_oban_jobs(namespace: :background)
  # Generates: background_list_oban_queues, etc.
end

Generated Tools

When Oban is available in the parent application, this macro generates:

  • list_oban_queues - List all configured queues with job statistics
  • get_queue_depth - Get job count for a specific queue
  • list_stuck_jobs - List executing jobs (optionally filterable)
  • retry_job - Retry a job by ID
  • cancel_job - Cancel/delete a job by ID

Optional Dependency

Oban is an optional dependency. If Oban is not in the application's dependencies, the macro will generate no tools (silently).

Configuration

The tools query Oban.Job directly and require:

  • An Ecto repo configured in the parent application
  • Oban tables migrated in the database
  • Oban started in the application supervision tree

Authorization

By default, Oban tools are public (no authorization). You can add authorization by wrapping the macro call or by implementing custom authorization at the MCP module level.

Summary

Functions

Exposes Oban job management tools.

Functions

expose_oban_jobs(opts \\ [])

(macro)

Exposes Oban job management tools.

Options

  • :namespace - Prefix tool names with namespace (e.g., :backgroundbackground_list_oban_queues)

Examples

expose_oban_jobs
# Generates: list_oban_queues, get_queue_depth, list_stuck_jobs, retry_job, cancel_job

expose_oban_jobs(namespace: :jobs)
# Generates: jobs_list_oban_queues, jobs_get_queue_depth, etc.