beplus-mcp 0.11.0 → 0.12.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 (2) hide show
  1. package/dist/index.js +63 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -157,7 +157,15 @@ var BeplusClient = class {
157
157
  return this.request("DELETE", `/generations/${id}`);
158
158
  }
159
159
  listGenerations(query) {
160
- return this.request("GET", "/generations", { query });
160
+ return this.request("GET", "/generations", {
161
+ query: {
162
+ limit: query.limit,
163
+ offset: query.offset,
164
+ // Only send when true — the backend treats truthy as "constrain".
165
+ favorite: query.favorite ? "true" : void 0,
166
+ approved: query.approved ? "true" : void 0
167
+ }
168
+ });
161
169
  }
162
170
  tts(body) {
163
171
  return this.request("POST", "/tts", { body, timeoutMs: 9e4 });
@@ -497,6 +505,22 @@ var DEFAULTS = {
497
505
  // src/tools/generation.ts
498
506
  var IMAGE_BUDGET_MS = 9e4;
499
507
  var VIDEO_BUDGET_MS = 12e4;
508
+ function flagsLine(g) {
509
+ const parts = [
510
+ g.is_favorite ? "\u2B50 like" : null,
511
+ g.is_approved_plan ? "\u2714\uFE0F aprovado" : null
512
+ ].filter(Boolean);
513
+ return parts.length ? `
514
+ ${parts.join(" \xB7 ")}` : "";
515
+ }
516
+ function firstOutputUrl(output) {
517
+ if (!output) return null;
518
+ const o = output;
519
+ if (Array.isArray(o) && typeof o[0] === "string") return o[0];
520
+ if (Array.isArray(o.urls) && typeof o.urls[0] === "string") return o.urls[0];
521
+ if (typeof o.url === "string") return o.url;
522
+ return null;
523
+ }
500
524
  function registerGenerationTools(server, client, cfg) {
501
525
  server.registerTool(
502
526
  "generate_image",
@@ -777,7 +801,7 @@ ${footer}`);
777
801
  const blocks = await buildImageBlocks(urls, cfg);
778
802
  const list = urls.map((u, i) => `${i + 1}. ${u}`).join("\n") || "(sem URLs)";
779
803
  return { content: [{ type: "text", text: `\u2705 Pronto.
780
- ${list}` }, ...blocks] };
804
+ ${list}${flagsLine(status)}` }, ...blocks] };
781
805
  }
782
806
  if (status.status === "failed") {
783
807
  return errorResult(`Gera\xE7\xE3o falhou: ${status.error_message || "erro desconhecido"}.`);
@@ -790,6 +814,43 @@ ${list}` }, ...blocks] };
790
814
  }
791
815
  }
792
816
  );
817
+ server.registerTool(
818
+ "list_generations",
819
+ {
820
+ title: "Listar gera\xE7\xF5es",
821
+ description: 'Lista as suas gera\xE7\xF5es (imagens/v\xEDdeos) mais recentes, com os flags de favorito ("like") e de plano aprovado. Use os filtros favorite=true / approved=true para ver s\xF3 as favoritadas ou s\xF3 as aprovadas. Retorna id, modelo, tipo, status, data, um trecho do prompt e (quando h\xE1) a URL.',
822
+ inputSchema: {
823
+ limit: z.number().int().min(1).max(100).optional().describe("Quantas trazer (padr\xE3o 20, m\xE1x 100)."),
824
+ offset: z.number().int().min(0).optional().describe("Deslocamento para paginar (padr\xE3o 0)."),
825
+ favorite: z.boolean().optional().describe('S\xF3 as favoritadas ("like"). Padr\xE3o: todas.'),
826
+ approved: z.boolean().optional().describe("S\xF3 as com plano aprovado. Padr\xE3o: todas.")
827
+ }
828
+ },
829
+ async ({ limit, offset, favorite, approved }) => {
830
+ try {
831
+ const { generations } = await client.listGenerations({ limit, offset, favorite, approved });
832
+ if (!generations.length) {
833
+ const scope = favorite && approved ? " (favoritadas + aprovadas)" : favorite ? " favoritadas" : approved ? " aprovadas" : "";
834
+ return textResult(`Nenhuma gera\xE7\xE3o${scope} encontrada.`);
835
+ }
836
+ const lines = generations.map((g, i) => {
837
+ const type = g.generation_type || "image";
838
+ const when = g.created_at ? new Date(g.created_at).toISOString().slice(0, 10) : "\u2014";
839
+ const prompt = (g.prompt || "").replace(/\s+/g, " ").slice(0, 80);
840
+ const url = firstOutputUrl(g.output);
841
+ const marks = [g.is_favorite ? "\u2B50" : null, g.is_approved_plan ? "\u2714\uFE0F" : null].filter(Boolean).join(" ");
842
+ const marksSuffix = marks ? ` ${marks}` : "";
843
+ return `${i + 1}. ${type} \xB7 ${g.status} \xB7 ${when} \xB7 ${g.model}${marksSuffix}
844
+ ${g.id}
845
+ "${prompt}"${url ? `
846
+ ${url}` : ""}`;
847
+ });
848
+ return textResult(lines.join("\n\n"));
849
+ } catch (e) {
850
+ return errorResult(apiErrorToUserMessage(e));
851
+ }
852
+ }
853
+ );
793
854
  server.registerTool(
794
855
  "cancel_generation",
795
856
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beplus-mcp",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Conector MCP da equipe BePlus — gere imagens/vídeos/áudio e consulte calls, projetos e clientes pela sua conta BePlus (diamantes, limites e histórico aplicados pela plataforma).",
5
5
  "type": "module",
6
6
  "bin": {