@thenavidm/midjourney-mcp-cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +677 -0
  3. package/SKILL.md +184 -0
  4. package/dist/api/client.d.ts +72 -0
  5. package/dist/api/client.js +278 -0
  6. package/dist/api/client.js.map +1 -0
  7. package/dist/api/download.d.ts +41 -0
  8. package/dist/api/download.js +108 -0
  9. package/dist/api/download.js.map +1 -0
  10. package/dist/api/errors.d.ts +75 -0
  11. package/dist/api/errors.js +166 -0
  12. package/dist/api/errors.js.map +1 -0
  13. package/dist/api/jobs.d.ts +140 -0
  14. package/dist/api/jobs.js +296 -0
  15. package/dist/api/jobs.js.map +1 -0
  16. package/dist/api/moodboards.d.ts +88 -0
  17. package/dist/api/moodboards.js +189 -0
  18. package/dist/api/moodboards.js.map +1 -0
  19. package/dist/capture.d.ts +27 -0
  20. package/dist/capture.js +162 -0
  21. package/dist/capture.js.map +1 -0
  22. package/dist/cli.d.ts +92 -0
  23. package/dist/cli.js +633 -0
  24. package/dist/cli.js.map +1 -0
  25. package/dist/config.d.ts +37 -0
  26. package/dist/config.js +90 -0
  27. package/dist/config.js.map +1 -0
  28. package/dist/content/prompt.d.ts +69 -0
  29. package/dist/content/prompt.js +173 -0
  30. package/dist/content/prompt.js.map +1 -0
  31. package/dist/doctor.d.ts +19 -0
  32. package/dist/doctor.js +161 -0
  33. package/dist/doctor.js.map +1 -0
  34. package/dist/format/jobs.d.ts +71 -0
  35. package/dist/format/jobs.js +211 -0
  36. package/dist/format/jobs.js.map +1 -0
  37. package/dist/index.d.ts +13 -0
  38. package/dist/index.js +161 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/safety.d.ts +52 -0
  41. package/dist/safety.js +100 -0
  42. package/dist/safety.js.map +1 -0
  43. package/dist/server.d.ts +10 -0
  44. package/dist/server.js +57 -0
  45. package/dist/server.js.map +1 -0
  46. package/dist/tools/create.d.ts +96 -0
  47. package/dist/tools/create.js +375 -0
  48. package/dist/tools/create.js.map +1 -0
  49. package/dist/tools/download.d.ts +17 -0
  50. package/dist/tools/download.js +47 -0
  51. package/dist/tools/download.js.map +1 -0
  52. package/dist/tools/explore.d.ts +8 -0
  53. package/dist/tools/explore.js +57 -0
  54. package/dist/tools/explore.js.map +1 -0
  55. package/dist/tools/index.d.ts +3 -0
  56. package/dist/tools/index.js +16 -0
  57. package/dist/tools/index.js.map +1 -0
  58. package/dist/tools/jobs.d.ts +18 -0
  59. package/dist/tools/jobs.js +92 -0
  60. package/dist/tools/jobs.js.map +1 -0
  61. package/dist/tools/kit.d.ts +84 -0
  62. package/dist/tools/kit.js +104 -0
  63. package/dist/tools/kit.js.map +1 -0
  64. package/dist/tools/library.d.ts +22 -0
  65. package/dist/tools/library.js +185 -0
  66. package/dist/tools/library.js.map +1 -0
  67. package/dist/tools/profile.d.ts +2 -0
  68. package/dist/tools/profile.js +89 -0
  69. package/dist/tools/profile.js.map +1 -0
  70. package/dist/transport/cdp.d.ts +217 -0
  71. package/dist/transport/cdp.js +607 -0
  72. package/dist/transport/cdp.js.map +1 -0
  73. package/dist/transport/http.d.ts +18 -0
  74. package/dist/transport/http.js +48 -0
  75. package/dist/transport/http.js.map +1 -0
  76. package/package.json +72 -0
@@ -0,0 +1,16 @@
1
+ /** Every tool, in the order they appear in the README. */
2
+ import { profileTools } from "./profile.js";
3
+ import { createTools } from "./create.js";
4
+ import { jobTools } from "./jobs.js";
5
+ import { downloadTools } from "./download.js";
6
+ import { libraryTools } from "./library.js";
7
+ import { exploreTools } from "./explore.js";
8
+ export const ALL_TOOLS = [
9
+ ...profileTools,
10
+ ...createTools,
11
+ ...jobTools,
12
+ ...downloadTools,
13
+ ...libraryTools,
14
+ ...exploreTools,
15
+ ];
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAI1D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,GAAG,YAAY;IACf,GAAG,WAAW;IACd,GAAG,QAAQ;IACX,GAAG,aAAa;IAChB,GAAG,YAAY;IACf,GAAG,YAAY;CACC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** Reading what the account has made and what it is making now. */
2
+ import { z } from "zod";
3
+ export declare const jobTools: (import("./kit.js").ToolSpec<{
4
+ status: z.ZodOptional<z.ZodEnum<["queued", "running", "completed", "failed", "moderated"]>>;
5
+ include_raw: z.ZodOptional<z.ZodBoolean>;
6
+ limit: z.ZodOptional<z.ZodNumber>;
7
+ cursor: z.ZodOptional<z.ZodString>;
8
+ }> | import("./kit.js").ToolSpec<{
9
+ job_id: z.ZodString;
10
+ include_raw: z.ZodOptional<z.ZodBoolean>;
11
+ }> | import("./kit.js").ToolSpec<{
12
+ job_id: z.ZodString;
13
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
14
+ }> | import("./kit.js").ToolSpec<{}> | import("./kit.js").ToolSpec<{
15
+ checkpoint: z.ZodOptional<z.ZodString>;
16
+ limit: z.ZodOptional<z.ZodNumber>;
17
+ cursor: z.ZodOptional<z.ZodString>;
18
+ }>)[];
@@ -0,0 +1,92 @@
1
+ /** Reading what the account has made and what it is making now. */
2
+ import { z } from "zod";
3
+ import { ENDPOINTS, findJob, jobUpdates, listJobs, waitForJob } from "../api/jobs.js";
4
+ import { NotFoundError } from "../api/errors.js";
5
+ import { summariseJob } from "../format/jobs.js";
6
+ import { clamp, defineTool, pageArgs } from "./kit.js";
7
+ export const jobTools = [
8
+ defineTool({
9
+ name: "list_jobs",
10
+ title: "List recent generations",
11
+ description: "List the account's recent Midjourney jobs, newest first, with their status and the URLs of any finished images.\n\nThis is the account's own history, not the public feed. Use explore_feed for other people's work.",
12
+ schema: {
13
+ ...pageArgs,
14
+ status: z
15
+ .enum(["queued", "running", "completed", "failed", "moderated"])
16
+ .optional()
17
+ .describe("Only return jobs in this state. Filtered here, since the endpoint has no filter."),
18
+ include_raw: z
19
+ .boolean()
20
+ .optional()
21
+ .describe("Return the untouched API response alongside the parsed jobs. Useful when a field looks wrong and you need to see what actually came back."),
22
+ },
23
+ risk: "read",
24
+ handler: async (args, ctx) => {
25
+ const limit = clamp(args.limit, 25);
26
+ const { jobs, raw } = await listJobs(ctx.client, { limit, cursor: args.cursor });
27
+ const filtered = args.status ? jobs.filter((job) => job.status === args.status) : jobs;
28
+ return {
29
+ count: filtered.length,
30
+ jobs: filtered.map(summariseJob),
31
+ ...(args.include_raw ? { raw } : {}),
32
+ };
33
+ },
34
+ }),
35
+ defineTool({
36
+ name: "get_job",
37
+ title: "Look up one job",
38
+ description: "Look up a single job by id and return its status and image URLs. Checks the live update feed first, then recent history.\n\nOnly jobs still in the account's recent feed can be resolved this way. Older work has to be opened in the web app.",
39
+ schema: {
40
+ job_id: z.string().describe("The job id, a UUID."),
41
+ include_raw: z.boolean().optional().describe("Also return the untouched job record."),
42
+ },
43
+ risk: "read",
44
+ handler: async (args, ctx) => {
45
+ const job = await findJob(ctx.client, args.job_id);
46
+ if (!job) {
47
+ throw new NotFoundError(`No job ${args.job_id} in this account's recent history.`, 404, ENDPOINTS.jobs);
48
+ }
49
+ return { ...summariseJob(job), ...(args.include_raw ? { raw: job.raw } : {}) };
50
+ },
51
+ }),
52
+ defineTool({
53
+ name: "wait_for_job",
54
+ title: "Wait for a job to finish",
55
+ description: "Block until a job reaches a finished, failed or moderated state, then return it with its image URLs.\n\nThe poll interval widens as the wait goes on, so a long relax-mode job does not turn into hundreds of requests. Times out after MIDJOURNEY_JOB_TIMEOUT_MS, ten minutes by default; a timeout does not cancel the job, it is still running.",
56
+ schema: {
57
+ job_id: z.string().describe("The job id to wait on."),
58
+ timeout_ms: z
59
+ .number()
60
+ .optional()
61
+ .describe("Give up after this long. Defaults to MIDJOURNEY_JOB_TIMEOUT_MS."),
62
+ },
63
+ risk: "read",
64
+ handler: async (args, ctx) => summariseJob(await waitForJob(ctx.client, args.job_id, { timeoutMs: args.timeout_ms })),
65
+ }),
66
+ defineTool({
67
+ name: "get_queue",
68
+ title: "Show what is running now",
69
+ description: "Show the account's current Midjourney queue: what is running, what is waiting, and how much concurrency the plan allows.\n\nThe first thing to check when a submitted job is not appearing. Accounts have a concurrent-job limit, and work past it silently queues behind the rest.",
70
+ schema: {},
71
+ risk: "read",
72
+ handler: async (_args, ctx) => ctx.client.request(ENDPOINTS.queue),
73
+ }),
74
+ defineTool({
75
+ name: "job_updates",
76
+ title: "Poll the live update feed",
77
+ description: "Poll the feed the web app itself watches while work is in flight. Returns jobs whose state has changed recently.\n\nPass the checkpoint from a previous response to get only what has changed since. Most callers want wait_for_job instead, which drives this loop for you.",
78
+ schema: {
79
+ ...pageArgs,
80
+ checkpoint: z.string().optional().describe("Checkpoint token from a previous response."),
81
+ },
82
+ risk: "read",
83
+ handler: async (args, ctx) => {
84
+ const { jobs, raw } = await jobUpdates(ctx.client, {
85
+ limit: clamp(args.limit, 25),
86
+ checkpoint: args.checkpoint,
87
+ });
88
+ return { count: jobs.length, jobs: jobs.map(summariseJob), raw };
89
+ },
90
+ }),
91
+ ];
92
+ //# sourceMappingURL=jobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../src/tools/jobs.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,O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,CAAC,EAAE,GAAG,EAAE,CAAC;QACnE,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Shared plumbing every tool uses.
3
+ *
4
+ * Registering tools by hand is one chance per tool to forget an annotation,
5
+ * leak a stack trace, or return a shape the model cannot read. This wraps all
6
+ * of it once so a tool module only describes what it actually does.
7
+ */
8
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ import { z, type ZodRawShape } from "zod";
10
+ import type { MidjourneyClient } from "../api/client.js";
11
+ import type { Config } from "../config.js";
12
+ import { needsConfirm, type Risk, type WriteGuard } from "../safety.js";
13
+ export type ToolContext = {
14
+ client: MidjourneyClient;
15
+ config: Config;
16
+ guard: WriteGuard;
17
+ };
18
+ export type ToolResult = {
19
+ content: {
20
+ type: "text";
21
+ text: string;
22
+ }[];
23
+ isError?: boolean;
24
+ };
25
+ /**
26
+ * Handlers return data, never pre-rendered text.
27
+ *
28
+ * The sibling Bluesky server got this wrong: its read handlers returned a
29
+ * formatted string, so `--json` handed back that string as a JSON value and
30
+ * `jq` had no fields to reach, while its writes returned objects. Two halves
31
+ * that disagree, and nothing on the page lets a reader predict which is which.
32
+ * Formatting is a presentation decision made here, at the edge, from data.
33
+ */
34
+ export declare function ok(data: unknown): ToolResult;
35
+ /**
36
+ * Errors come back as a normal result with `isError`, not a thrown exception.
37
+ *
38
+ * A thrown MCP error reaches the model as a protocol failure with no structure.
39
+ * A result it can read says what went wrong and usually how to fix it, which is
40
+ * the difference between a correct retry and a give-up.
41
+ */
42
+ export declare function fail(error: unknown): ToolResult;
43
+ /** Required by every tool that spends money or cannot be undone. */
44
+ export declare const confirmArg: {
45
+ confirm: z.ZodOptional<z.ZodBoolean>;
46
+ };
47
+ /** Paging, on every tool that returns a list. */
48
+ export declare const pageArgs: {
49
+ limit: z.ZodOptional<z.ZodNumber>;
50
+ cursor: z.ZodOptional<z.ZodString>;
51
+ };
52
+ export type ToolSpec<S extends ZodRawShape> = {
53
+ name: string;
54
+ /** One line, imperative. Shown in tool pickers. */
55
+ title: string;
56
+ description: string;
57
+ schema: S;
58
+ risk: Risk;
59
+ /** True when calling twice has the same effect as calling once. */
60
+ idempotent?: boolean;
61
+ handler: (args: z.infer<z.ZodObject<S>>, ctx: ToolContext) => Promise<unknown>;
62
+ /** One line for the audit log and the confirm message, when this changes something. */
63
+ summary?: (args: z.infer<z.ZodObject<S>>) => string;
64
+ };
65
+ export declare function defineTool<S extends ZodRawShape>(spec: ToolSpec<S>): ToolSpec<S>;
66
+ /**
67
+ * A tool of any shape, for the one place tools are held together in a list.
68
+ *
69
+ * `ToolSpec` is generic over its schema, so a list of tools with different
70
+ * schemas has no single type: each handler takes a different argument shape and
71
+ * function parameters are contravariant. The type safety that matters lives
72
+ * inside each `defineTool` call, where schema and handler are checked against
73
+ * each other. This only loosens the seam where they are collected.
74
+ */
75
+ export type AnyToolSpec = Omit<ToolSpec<ZodRawShape>, "handler" | "summary"> & {
76
+ handler: (args: never, ctx: ToolContext) => Promise<unknown>;
77
+ summary?: (args: never) => string;
78
+ };
79
+ /** Register one tool against the server, with guarding and error handling applied. */
80
+ export declare function register(server: McpServer, contextFor: (extra: unknown) => ToolContext, spec: AnyToolSpec): void;
81
+ export declare function makeContext(client: MidjourneyClient, config: Config, guard: WriteGuard): ToolContext;
82
+ /** Clamp a caller-supplied limit into something the app will accept. */
83
+ export declare function clamp(value: number | undefined, fallback: number, max?: number): number;
84
+ export { needsConfirm };
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Shared plumbing every tool uses.
3
+ *
4
+ * Registering tools by hand is one chance per tool to forget an annotation,
5
+ * leak a stack trace, or return a shape the model cannot read. This wraps all
6
+ * of it once so a tool module only describes what it actually does.
7
+ */
8
+ import { z } from "zod";
9
+ import { MidjourneyError } from "../api/errors.js";
10
+ import { annotationsFor, needsConfirm } from "../safety.js";
11
+ /**
12
+ * Handlers return data, never pre-rendered text.
13
+ *
14
+ * The sibling Bluesky server got this wrong: its read handlers returned a
15
+ * formatted string, so `--json` handed back that string as a JSON value and
16
+ * `jq` had no fields to reach, while its writes returned objects. Two halves
17
+ * that disagree, and nothing on the page lets a reader predict which is which.
18
+ * Formatting is a presentation decision made here, at the edge, from data.
19
+ */
20
+ export function ok(data) {
21
+ const text = typeof data === "string" ? data : JSON.stringify(data, null, 2);
22
+ return { content: [{ type: "text", text }] };
23
+ }
24
+ /**
25
+ * Errors come back as a normal result with `isError`, not a thrown exception.
26
+ *
27
+ * A thrown MCP error reaches the model as a protocol failure with no structure.
28
+ * A result it can read says what went wrong and usually how to fix it, which is
29
+ * the difference between a correct retry and a give-up.
30
+ */
31
+ export function fail(error) {
32
+ const payload = error instanceof MidjourneyError
33
+ ? error.toJSON()
34
+ : { error: error?.message ?? String(error) };
35
+ return {
36
+ content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
37
+ isError: true,
38
+ };
39
+ }
40
+ /** Required by every tool that spends money or cannot be undone. */
41
+ export const confirmArg = {
42
+ confirm: z
43
+ .boolean()
44
+ .optional()
45
+ .describe("Must be true for this to run. This call spends GPU time from the Midjourney plan, or cannot be undone, so it is refused without an explicit confirmation."),
46
+ };
47
+ /** Paging, on every tool that returns a list. */
48
+ export const pageArgs = {
49
+ limit: z
50
+ .number()
51
+ .int()
52
+ .min(1)
53
+ .max(100)
54
+ .optional()
55
+ .describe("How many to return, 1-100. Defaults to 25."),
56
+ cursor: z
57
+ .string()
58
+ .optional()
59
+ .describe("Continue from a previous page. Pass the `cursor` from the last result."),
60
+ };
61
+ export function defineTool(spec) {
62
+ return spec;
63
+ }
64
+ /** Register one tool against the server, with guarding and error handling applied. */
65
+ export function register(server, contextFor, spec) {
66
+ server.registerTool(spec.name, {
67
+ title: spec.title,
68
+ description: spec.description,
69
+ inputSchema: spec.schema,
70
+ annotations: {
71
+ title: spec.title,
72
+ ...annotationsFor(spec.risk, { idempotent: spec.idempotent }),
73
+ },
74
+ },
75
+ // The SDK derives its callback type from the schema generic. This wrapper is
76
+ // generic over the same shape, but TypeScript cannot prove the two are equal
77
+ // through the indirection, so the cast lives at this single boundary rather
78
+ // than in every tool definition.
79
+ (async (args, extra) => {
80
+ try {
81
+ const ctx = contextFor(extra);
82
+ if (spec.risk !== "read") {
83
+ const summary = spec.summary?.(args) ?? spec.name;
84
+ const confirm = args.confirm;
85
+ ctx.guard.check(spec.name, spec.risk, confirm, summary);
86
+ }
87
+ return ok(await spec.handler(args, ctx));
88
+ }
89
+ catch (error) {
90
+ return fail(error);
91
+ }
92
+ }));
93
+ }
94
+ export function makeContext(client, config, guard) {
95
+ return { client, config, guard };
96
+ }
97
+ /** Clamp a caller-supplied limit into something the app will accept. */
98
+ export function clamp(value, fallback, max = 100) {
99
+ if (value === undefined || !Number.isFinite(value))
100
+ return fallback;
101
+ return Math.min(Math.max(Math.trunc(value), 1), max);
102
+ }
103
+ export { needsConfirm };
104
+ //# sourceMappingURL=kit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kit.js","sourceRoot":"","sources":["../../src/tools/kit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,CAAC,EAAoB,MAAM,KAAK,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,YAAY,EAA8B,MAAM,cAAc,CAAC;AAaxF;;;;;;;;GAQG;AACH,MAAM,UAAU,EAAE,CAAC,IAAa;IAC9B,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7E,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,KAAc;IACjC,MAAM,OAA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C,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** The account's own organised work: folders, moodboards, storage. */
2
+ import { z } from "zod";
3
+ export declare const libraryTools: (import("./kit.js").ToolSpec<{}> | import("./kit.js").ToolSpec<{
4
+ with_images: z.ZodOptional<z.ZodBoolean>;
5
+ }> | import("./kit.js").ToolSpec<{
6
+ moodboard: z.ZodString;
7
+ references: z.ZodOptional<z.ZodNumber>;
8
+ }> | import("./kit.js").ToolSpec<{
9
+ title: z.ZodString;
10
+ }> | import("./kit.js").ToolSpec<{
11
+ moodboard: z.ZodString;
12
+ job_id: z.ZodOptional<z.ZodString>;
13
+ indexes: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
14
+ urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
+ }> | import("./kit.js").ToolSpec<{
16
+ confirm: z.ZodOptional<z.ZodBoolean>;
17
+ moodboard: z.ZodString;
18
+ urls: z.ZodArray<z.ZodString, "many">;
19
+ }> | import("./kit.js").ToolSpec<{
20
+ path: z.ZodString;
21
+ query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
22
+ }>)[];
@@ -0,0 +1,185 @@
1
+ /** The account's own organised work: folders, moodboards, storage. */
2
+ import { z } from "zod";
3
+ import { ENDPOINTS } from "../api/jobs.js";
4
+ import { addToMoodboard, createMoodboard, listMoodboards, matchMoodboard, pickReferences, removeFromMoodboard, } from "../api/moodboards.js";
5
+ import { findJob } from "../api/jobs.js";
6
+ import { NotFoundError } from "../api/errors.js";
7
+ import { confirmArg } from "./kit.js";
8
+ import { defineTool } from "./kit.js";
9
+ export const libraryTools = [
10
+ defineTool({
11
+ name: "list_folders",
12
+ title: "List organise folders",
13
+ description: "List the folders in the account's Organise view, the ones used to sort generations in the web app.",
14
+ schema: {},
15
+ risk: "read",
16
+ handler: async (_args, ctx) => ctx.client.request(ENDPOINTS.folders),
17
+ }),
18
+ defineTool({
19
+ name: "list_moodboards",
20
+ title: "List moodboards",
21
+ description: "List the account's moodboards with how many reference images each holds.\n\nA moodboard is a curated pile of images defining a look. Any of these can be passed straight to imagine as `moodboard: \"High Fashion\"`, which turns its images into style references. That is usually a better way to get a consistent look than describing it in words.\n\nBoards showing 0 images exist but are empty, so they cannot be used as a reference until something is added in the web app.",
22
+ schema: {
23
+ with_images: z
24
+ .boolean()
25
+ .optional()
26
+ .describe("Include every image URL. Off by default: a large board is hundreds of URLs."),
27
+ },
28
+ risk: "read",
29
+ handler: async (args, ctx) => {
30
+ const boards = await listMoodboards(ctx.client);
31
+ return {
32
+ count: boards.length,
33
+ moodboards: boards.map((board) => ({
34
+ id: board.id,
35
+ title: board.title,
36
+ image_count: board.images.length,
37
+ usable_as_reference: board.images.length > 0,
38
+ ...(args.with_images ? { images: board.images.map((image) => image.url) } : {}),
39
+ })),
40
+ };
41
+ },
42
+ }),
43
+ defineTool({
44
+ name: "get_moodboard",
45
+ title: "Look up one moodboard",
46
+ description: "Look up a moodboard by name or id and return its reference images.\n\nPartial names work: 'High Fashion' finds 'High Fashion | Woman'. An ambiguous name is an error listing the candidates rather than a guess, because quietly picking the wrong board costs a generation to discover.\n\nUse `references` to get the sampled subset a generation would actually use, spread across the board rather than taken from the front.",
47
+ schema: {
48
+ moodboard: z.string().describe("Name or id. Partial names are fine when unambiguous."),
49
+ references: z
50
+ .number()
51
+ .int()
52
+ .min(1)
53
+ .max(10)
54
+ .optional()
55
+ .describe("Return this many sampled image URLs, as imagine would use them."),
56
+ },
57
+ risk: "read",
58
+ handler: async (args, ctx) => {
59
+ const board = matchMoodboard(await listMoodboards(ctx.client), args.moodboard);
60
+ return {
61
+ id: board.id,
62
+ title: board.title,
63
+ image_count: board.images.length,
64
+ ...(board.created ? { created: board.created } : {}),
65
+ ...(args.references
66
+ ? { references: pickReferences(board, args.references) }
67
+ : { images: board.images.map((image) => image.url) }),
68
+ };
69
+ },
70
+ }),
71
+ defineTool({
72
+ name: "create_moodboard",
73
+ title: "Create a moodboard",
74
+ description: "Create a new, empty moodboard on the account.\n\nThe usual loop: create a board for a look, generate images until some are right, then add those with add_to_moodboard. From then on the board can drive new work by name, which is how a style gets reused instead of re-described.\n\nAn empty board cannot be used as a reference until it has at least one image.",
75
+ schema: {
76
+ title: z.string().min(1).describe("What to call it, for example 'Nordic Minimal Interiors'."),
77
+ },
78
+ risk: "write",
79
+ idempotent: false,
80
+ summary: (args) => `create moodboard '${String(args.title)}'`,
81
+ handler: async (args, ctx) => {
82
+ const created = await createMoodboard(ctx.client, args.title);
83
+ return {
84
+ ...created,
85
+ next: "Add images with add_to_moodboard, then use it on a generation with moodboard: '<title>'.",
86
+ };
87
+ },
88
+ }),
89
+ defineTool({
90
+ name: "add_to_moodboard",
91
+ title: "Add images to a moodboard",
92
+ description: "Add images to a moodboard, either from a job you generated or by direct URL.\n\nPass job_id to add that job's renders, optionally narrowing with indexes. Pass urls to add anything else the account can reach.\n\nThis is the step that turns a good generation into a reusable style: once the images are on a board, `moodboard: \"<title>\"` on a later generation reproduces the look without describing it again.",
93
+ schema: {
94
+ moodboard: z.string().describe("Name or id of the board to add to. Partial names work."),
95
+ job_id: z.string().optional().describe("Add the renders from this job."),
96
+ indexes: z
97
+ .array(z.number().int().min(0))
98
+ .optional()
99
+ .describe("With job_id, which images to add, zero-based. Omit for all four."),
100
+ urls: z.array(z.string()).optional().describe("Add these image URLs directly."),
101
+ },
102
+ // No confirmation: adding is reversible with remove_from_moodboard, and
103
+ // gating reversible things is how a model learns to pass confirm by
104
+ // reflex, which is exactly what the gate on spending exists to prevent.
105
+ risk: "write",
106
+ idempotent: false,
107
+ summary: (args) => `add ${args.job_id ? `job ${String(args.job_id)}` : `${args.urls?.length ?? 0} url(s)`} to moodboard '${String(args.moodboard)}'`,
108
+ handler: async (args, ctx) => {
109
+ const board = matchMoodboard(await listMoodboards(ctx.client), args.moodboard);
110
+ const images = [];
111
+ if (args.job_id) {
112
+ const job = await findJob(ctx.client, args.job_id);
113
+ if (!job) {
114
+ throw new NotFoundError(`No job ${args.job_id} in this account's recent history.`, 404, "(local)");
115
+ }
116
+ const wanted = args.indexes?.length ? args.indexes : job.images.map((_, index) => index);
117
+ for (const index of wanted) {
118
+ const url = job.images[index];
119
+ if (url) {
120
+ images.push({
121
+ url,
122
+ ...(job.width ? { width: job.width } : {}),
123
+ ...(job.height ? { height: job.height } : {}),
124
+ });
125
+ }
126
+ }
127
+ }
128
+ for (const url of args.urls ?? [])
129
+ images.push({ url });
130
+ const result = await addToMoodboard(ctx.client, board.id, images);
131
+ return {
132
+ moodboard: { id: board.id, title: board.title },
133
+ added: result.added,
134
+ images: images.map((image) => image.url),
135
+ };
136
+ },
137
+ }),
138
+ defineTool({
139
+ name: "remove_from_moodboard",
140
+ title: "Remove images from a moodboard",
141
+ description: "Remove images from a moodboard by URL.\n\nCuration is the point of a moodboard, so this is how a board stays sharp. It cannot be undone from here: the board is edited in place and there is no history, which is why it needs confirmation.",
142
+ schema: {
143
+ moodboard: z.string().describe("Name or id of the board. Partial names work."),
144
+ urls: z.array(z.string()).min(1).describe("Exact image URLs to remove, as get_moodboard reports them."),
145
+ ...confirmArg,
146
+ },
147
+ risk: "destructive",
148
+ idempotent: true,
149
+ summary: (args) => `remove ${args.urls.length} image(s) from moodboard '${String(args.moodboard)}'`,
150
+ handler: async (args, ctx) => {
151
+ const board = matchMoodboard(await listMoodboards(ctx.client), args.moodboard);
152
+ const result = await removeFromMoodboard(ctx.client, board.id, args.urls);
153
+ return { moodboard: { id: board.id, title: board.title }, removed: result.removed };
154
+ },
155
+ }),
156
+ defineTool({
157
+ name: "get_storage",
158
+ title: "Show account storage",
159
+ description: "Show the storage metadata the web app exposes: how much space the account's generations occupy against what the plan allows.",
160
+ schema: {},
161
+ risk: "read",
162
+ handler: async (_args, ctx) => ctx.client.request(ENDPOINTS.storage),
163
+ }),
164
+ defineTool({
165
+ name: "api_get",
166
+ title: "Call any Midjourney web endpoint",
167
+ description: "Issue a GET against an arbitrary path on midjourney.com and return the JSON. The escape hatch for endpoints this server has no named tool for.\n\nMidjourney publishes no API, so the set of endpoints is whatever its web app happens to call this month. Discover them with `midjourney-cli capture`, which records the real traffic while you use the site, then read them here. Paths must start with /api/.",
168
+ schema: {
169
+ path: z.string().describe("Path starting with /api/, for example '/api/folders'."),
170
+ query: z
171
+ .record(z.union([z.string(), z.number(), z.boolean()]))
172
+ .optional()
173
+ .describe("Query parameters to append."),
174
+ },
175
+ risk: "read",
176
+ handler: async (args, ctx) => {
177
+ const path = args.path.trim();
178
+ if (!path.startsWith("/api/")) {
179
+ throw new Error(`Path must start with /api/. Got '${path}'. This tool reaches Midjourney's own JSON endpoints, not arbitrary pages.`);
180
+ }
181
+ return ctx.client.request(path, { query: args.query });
182
+ },
183
+ }),
184
+ ];
185
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../src/tools/library.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,UAAU,CAAC;QACT,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,uBAAuB;QAC9B,WAAW,E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C,IAAI,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CACb,oCAAoC,IAAI,4EAA4E,CACrH,CAAC;YACJ,CAAC;YACD,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACzD,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** Who the session is, and the personalisation attached to it. */
2
+ export declare const profileTools: import("./kit.js").ToolSpec<{}>[];