Ported their real HTTP APIs (hal carried no client for these). jackett: an indexer proxy — tools only (list indexers, search), no events, no broker account, because it answers queries and has no timeline to observe. bazarr: subtitle tools + emits module.bazarr.subtitle.downloaded (poll history, diff). ombi: request tools + emits request.created/.approved. All pure emitters (their decisions originate here). Typecheck; manifests parse.
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
// ombi's tools — its own code (novox/hq ADR 0044), importing ombi's client. They return structured
|
|
// data; the mesh serves them through the sdk's tool harness.
|
|
|
|
import { registerModuleTools, type ToolDefinition } from "@novox/mesh-sdk/tools";
|
|
import { OmbiClient } from "../client.js";
|
|
|
|
export function getOmbiTools(ombi: OmbiClient): ToolDefinition[] {
|
|
return [
|
|
{
|
|
name: "ombi_requests",
|
|
description: "List media requests — movies and shows — with who asked and whether each is approved or available.",
|
|
input: { pending: { type: "boolean", description: "only requests not yet approved (default false)" } },
|
|
run: async (args) => {
|
|
let requests = await ombi.getRequests();
|
|
if (args.pending) requests = requests.filter((r) => !r.approved && !r.denied);
|
|
const counts = await ombi.getCounts();
|
|
return { counts, count: requests.length, requests };
|
|
},
|
|
},
|
|
{
|
|
name: "ombi_approve",
|
|
description: "Approve a media request by its kind and id (from ombi_requests).",
|
|
input: {
|
|
kind: { type: "string", description: '"movie" or "tv"' },
|
|
id: { type: "number", description: "the request id" },
|
|
},
|
|
run: async (args) => {
|
|
const kind = String(args.kind);
|
|
if (kind !== "movie" && kind !== "tv") throw new Error('kind must be "movie" or "tv"');
|
|
const id = Number(args.id);
|
|
await ombi.approve(kind, id);
|
|
return { approved: { kind, id } };
|
|
},
|
|
},
|
|
];
|
|
}
|
|
|
|
// Exposed only when Ombi is configured; otherwise ombi contributes no tools rather than failing the
|
|
// whole runtime.
|
|
registerModuleTools("ombi", (env) => {
|
|
try {
|
|
return getOmbiTools(OmbiClient.fromEnv(env));
|
|
} catch {
|
|
return [];
|
|
}
|
|
});
|