@acruxcoreai/mcp-server 0.2.0 → 0.3.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.
package/dist/index.mjs CHANGED
@@ -747,21 +747,29 @@ var evaluationTools = [
747
747
  title: "Create and start an experiment run",
748
748
  toolset: "evaluations",
749
749
  readOnlyHint: false,
750
- description: "Create an experiment over a dataset and immediately start a run of it. The grid is every (version x model) pair you list. When `prompt` is given, a baseline cell for its production alias is added automatically unless that version is already in the grid. Returns as soon as the run is queued \u2014 the worker executes it asynchronously, so poll get_experiment_run for results. Note the judge model (gpt-4o-mini by default) must itself be registered in the gateway or every score fails.",
750
+ description: "Create an experiment over a dataset and immediately start a run of it. The grid is every (version x model) pair you list. When `prompt` is given, a baseline cell for its production alias is added automatically unless that version is already in the grid. Returns as soon as the run is queued \u2014 the worker executes it asynchronously, so poll get_experiment_run for results. `judge_model` scores every answer and must be registered in the gateway (see list_models). `judge_prompt` grades with one of your prompts instead of the built-in judge.",
751
751
  inputSchema: {
752
752
  dataset_id: z2.string().uuid().describe("Dataset to evaluate against."),
753
753
  version_ids: z2.array(z2.string().uuid()).min(1).describe("Prompt-version UUIDs to sweep. At least one."),
754
754
  models: z2.array(z2.string().min(1)).min(1).describe("Gateway model public names to sweep."),
755
755
  prompt: z2.string().optional().describe("Prompt name or UUID under test \u2014 enables the automatic baseline cell."),
756
756
  name: z2.string().optional().describe("Experiment name, for the run history."),
757
- alias: z2.string().optional().describe('Which alias the automatic baseline points at. Default "production".')
757
+ alias: z2.string().optional().describe('Which alias the automatic baseline points at. Default "production".'),
758
+ judge_model: z2.string().min(1).describe("Gateway model that scores every answer. Required."),
759
+ judge_prompt: z2.string().min(1).optional().describe(
760
+ "Name or UUID of a team prompt that grades instead of the built-in judge. The run uses its production version (else its latest). Default: the built-in judge."
761
+ )
758
762
  },
759
763
  async handler(args, { client, config }) {
760
764
  const body = {
761
765
  dataset_id: args.dataset_id,
762
766
  version_ids: args.version_ids,
763
- models: args.models
767
+ models: args.models,
768
+ judge_model: args.judge_model
764
769
  };
770
+ if (args.judge_prompt !== void 0) {
771
+ body.judge_prompt_id = await resolvePromptRef(client, args.judge_prompt);
772
+ }
765
773
  if (args.name !== void 0) body.name = args.name;
766
774
  if (args.alias !== void 0) body.alias = args.alias;
767
775
  if (args.prompt !== void 0) body.prompt_id = await resolvePromptRef(client, args.prompt);
@@ -828,7 +836,7 @@ var evaluationTools = [
828
836
  title: "Start an optimizer run for a prompt",
829
837
  toolset: "evaluations",
830
838
  readOnlyHint: false,
831
- description: 'Ask the optimizer to improve a prompt against a dataset. An optimizer model drafts up to `draft_count` rewrites of the version behind `alias` (default "production"), then every rewrite and that baseline run over the dataset on each of `models`, and `judge_model` scores every answer. Returns the run id as soon as the run is queued \u2014 drafting and scoring take minutes, so poll get_optimize_report. Nothing is promoted automatically: a rewrite only ships when promote_optimize_candidate is called. The dataset\'s examples need `criteria`, or the judge has nothing to grade against. Every model named here must be registered in the gateway (see list_models).',
839
+ description: 'Ask the optimizer to improve a prompt against a dataset. An optimizer model drafts `draft_count` rewrites of the version behind `alias` (default "production"), then every rewrite and that baseline run over the dataset on each of `models`, and `judge_model` scores every answer. Returns the run id as soon as the run is queued \u2014 drafting and scoring take minutes, so poll get_optimize_report. Nothing is promoted automatically: a rewrite only ships when promote_optimize_candidate is called. The dataset\'s examples need `criteria`, or the built-in judge has nothing to grade against. `judge_prompt` grades with one of your prompts instead, and the optimizer reads it too, so the rewrites aim at that rubric. Every model named here must be registered in the gateway (see list_models).',
832
840
  inputSchema: {
833
841
  prompt: z2.string().min(1).describe("Prompt name or UUID to improve."),
834
842
  dataset_id: z2.string().uuid().describe("Dataset whose examples the rewrites are scored on."),
@@ -837,7 +845,10 @@ var evaluationTools = [
837
845
  optimizer_model: z2.string().min(1).optional().describe("Gateway model that writes the rewrites. Default: the first entry of `models`."),
838
846
  draft_count: z2.number().int().min(1).max(6).optional().describe("How many rewrites to draft, 1 to 6. Default 3."),
839
847
  alias: z2.string().min(1).optional().describe('Alias whose version is the baseline to beat. Default "production".'),
840
- optimizer_prompt: z2.string().optional().describe("Name or UUID of a team prompt to use as the optimizer's instructions.")
848
+ optimizer_prompt: z2.string().optional().describe("Name or UUID of a team prompt to use as the optimizer's instructions."),
849
+ judge_prompt: z2.string().min(1).optional().describe(
850
+ "Name or UUID of a team prompt that grades instead of the built-in judge. The run uses its production version (else its latest). Default: the built-in judge."
851
+ )
841
852
  },
842
853
  async handler(args, { client, config }) {
843
854
  const promptId = await resolvePromptRef(client, args.prompt);
@@ -852,6 +863,9 @@ var evaluationTools = [
852
863
  if (args.optimizer_prompt !== void 0) {
853
864
  body.optimizer_prompt_id = await resolvePromptRef(client, args.optimizer_prompt);
854
865
  }
866
+ if (args.judge_prompt !== void 0) {
867
+ body.judge_prompt_id = await resolvePromptRef(client, args.judge_prompt);
868
+ }
855
869
  const result = await client.post(`/prompts/${promptId}/optimize`, body);
856
870
  const warning = result.prompt_mismatch_warning ? " Warning: some dataset examples were built from a different prompt \u2014 see prompt_mismatch_warning." : "";
857
871
  return okResult(
@@ -920,12 +934,17 @@ var evaluationTools = [
920
934
  });
921
935
  const best = bestCandidate(candidates);
922
936
  const winners = candidates.filter((candidate) => candidate.beatsBaseline).length;
923
- const summary = best ? `Optimize run ${run_id} succeeded. ${winners} of ${candidates.length} rewrite(s) beat the baseline. Recommended: ${best.label} (candidate_id ${best.candidateId}), ` + best.scores.map((score) => `${formatDelta(score.scoreDelta)} on ${score.model}`).join(", ") + ". Promote it with promote_optimize_candidate only if the user agrees." : `Optimize run ${run_id} succeeded, but none of its ${candidates.length} rewrite(s) beat the baseline. Nothing is worth promoting; keep the current version.`;
937
+ const rejected = report?.optimizerRejections ?? [];
938
+ const rejectedNote = rejected.length > 0 ? ` ${rejected.length} more rewrite(s) were dropped before scoring: ${rejected.join(" | ")}.` : "";
939
+ const summary = (best ? `Optimize run ${run_id} succeeded. ${winners} of ${candidates.length} rewrite(s) beat the baseline. Recommended: ${best.label} (candidate_id ${best.candidateId}), ` + best.scores.map((score) => `${formatDelta(score.scoreDelta)} on ${score.model}`).join(", ") + ". Promote it with promote_optimize_candidate only if the user agrees." : `Optimize run ${run_id} succeeded, but none of its ${candidates.length} rewrite(s) beat the baseline. Nothing is worth promoting; keep the current version.`) + rejectedNote;
924
940
  const payload = {
925
941
  runId: run_id,
926
942
  status: run.status,
927
943
  judgeModel: report?.judge?.model ?? null,
944
+ // Null means the built-in judge graded the run.
945
+ judgePromptVersionId: report?.judge?.promptVersionId ?? null,
928
946
  recommended: best?.candidateId ?? null,
947
+ rejectedRewrites: rejected,
929
948
  baseline: (report?.cells ?? []).filter((cell) => cell.isProductionBaseline).map((cell) => ({
930
949
  label: cell.variantLabel,
931
950
  model: cell.model,
@@ -1550,7 +1569,7 @@ function selectTools(config) {
1550
1569
  }
1551
1570
 
1552
1571
  // src/server.ts
1553
- var SERVER_VERSION = "0.2.0";
1572
+ var SERVER_VERSION = "0.3.0";
1554
1573
  function buildInstructions(toolNames, readOnly) {
1555
1574
  const parts = [
1556
1575
  `AcruxCore is an LLM-ops platform: a prompt registry, a versioned tool catalog, an AI gateway, tracing, and evaluation.