@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/bin.mjs CHANGED
@@ -828,21 +828,29 @@ var evaluationTools = [
828
828
  title: "Create and start an experiment run",
829
829
  toolset: "evaluations",
830
830
  readOnlyHint: false,
831
- 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.",
831
+ 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.",
832
832
  inputSchema: {
833
833
  dataset_id: z2.string().uuid().describe("Dataset to evaluate against."),
834
834
  version_ids: z2.array(z2.string().uuid()).min(1).describe("Prompt-version UUIDs to sweep. At least one."),
835
835
  models: z2.array(z2.string().min(1)).min(1).describe("Gateway model public names to sweep."),
836
836
  prompt: z2.string().optional().describe("Prompt name or UUID under test \u2014 enables the automatic baseline cell."),
837
837
  name: z2.string().optional().describe("Experiment name, for the run history."),
838
- alias: z2.string().optional().describe('Which alias the automatic baseline points at. Default "production".')
838
+ alias: z2.string().optional().describe('Which alias the automatic baseline points at. Default "production".'),
839
+ judge_model: z2.string().min(1).describe("Gateway model that scores every answer. Required."),
840
+ judge_prompt: z2.string().min(1).optional().describe(
841
+ "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."
842
+ )
839
843
  },
840
844
  async handler(args, { client, config }) {
841
845
  const body = {
842
846
  dataset_id: args.dataset_id,
843
847
  version_ids: args.version_ids,
844
- models: args.models
848
+ models: args.models,
849
+ judge_model: args.judge_model
845
850
  };
851
+ if (args.judge_prompt !== void 0) {
852
+ body.judge_prompt_id = await resolvePromptRef(client, args.judge_prompt);
853
+ }
846
854
  if (args.name !== void 0) body.name = args.name;
847
855
  if (args.alias !== void 0) body.alias = args.alias;
848
856
  if (args.prompt !== void 0) body.prompt_id = await resolvePromptRef(client, args.prompt);
@@ -909,7 +917,7 @@ var evaluationTools = [
909
917
  title: "Start an optimizer run for a prompt",
910
918
  toolset: "evaluations",
911
919
  readOnlyHint: false,
912
- 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).',
920
+ 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).',
913
921
  inputSchema: {
914
922
  prompt: z2.string().min(1).describe("Prompt name or UUID to improve."),
915
923
  dataset_id: z2.string().uuid().describe("Dataset whose examples the rewrites are scored on."),
@@ -918,7 +926,10 @@ var evaluationTools = [
918
926
  optimizer_model: z2.string().min(1).optional().describe("Gateway model that writes the rewrites. Default: the first entry of `models`."),
919
927
  draft_count: z2.number().int().min(1).max(6).optional().describe("How many rewrites to draft, 1 to 6. Default 3."),
920
928
  alias: z2.string().min(1).optional().describe('Alias whose version is the baseline to beat. Default "production".'),
921
- optimizer_prompt: z2.string().optional().describe("Name or UUID of a team prompt to use as the optimizer's instructions.")
929
+ optimizer_prompt: z2.string().optional().describe("Name or UUID of a team prompt to use as the optimizer's instructions."),
930
+ judge_prompt: z2.string().min(1).optional().describe(
931
+ "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."
932
+ )
922
933
  },
923
934
  async handler(args, { client, config }) {
924
935
  const promptId = await resolvePromptRef(client, args.prompt);
@@ -933,6 +944,9 @@ var evaluationTools = [
933
944
  if (args.optimizer_prompt !== void 0) {
934
945
  body.optimizer_prompt_id = await resolvePromptRef(client, args.optimizer_prompt);
935
946
  }
947
+ if (args.judge_prompt !== void 0) {
948
+ body.judge_prompt_id = await resolvePromptRef(client, args.judge_prompt);
949
+ }
936
950
  const result = await client.post(`/prompts/${promptId}/optimize`, body);
937
951
  const warning = result.prompt_mismatch_warning ? " Warning: some dataset examples were built from a different prompt \u2014 see prompt_mismatch_warning." : "";
938
952
  return okResult(
@@ -1001,12 +1015,17 @@ var evaluationTools = [
1001
1015
  });
1002
1016
  const best = bestCandidate(candidates);
1003
1017
  const winners = candidates.filter((candidate) => candidate.beatsBaseline).length;
1004
- 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.`;
1018
+ const rejected = report?.optimizerRejections ?? [];
1019
+ const rejectedNote = rejected.length > 0 ? ` ${rejected.length} more rewrite(s) were dropped before scoring: ${rejected.join(" | ")}.` : "";
1020
+ 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;
1005
1021
  const payload = {
1006
1022
  runId: run_id,
1007
1023
  status: run.status,
1008
1024
  judgeModel: report?.judge?.model ?? null,
1025
+ // Null means the built-in judge graded the run.
1026
+ judgePromptVersionId: report?.judge?.promptVersionId ?? null,
1009
1027
  recommended: best?.candidateId ?? null,
1028
+ rejectedRewrites: rejected,
1010
1029
  baseline: (report?.cells ?? []).filter((cell) => cell.isProductionBaseline).map((cell) => ({
1011
1030
  label: cell.variantLabel,
1012
1031
  model: cell.model,
@@ -1631,7 +1650,7 @@ function selectTools(config) {
1631
1650
  }
1632
1651
 
1633
1652
  // src/server.ts
1634
- var SERVER_VERSION = "0.2.0";
1653
+ var SERVER_VERSION = "0.3.0";
1635
1654
  function buildInstructions(toolNames, readOnly) {
1636
1655
  const parts = [
1637
1656
  `AcruxCore is an LLM-ops platform: a prompt registry, a versioned tool catalog, an AI gateway, tracing, and evaluation.