Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/server/src/mcp/toolkits/workflow/tools.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { expect, it } from "@effect/vitest";
import * as Schema from "effect/Schema";

import { WorkflowToolkit } from "./tools.ts";

it("signal keeps a wait's exact name", () => {
const decode = Schema.decodeUnknownSync(WorkflowToolkit.tools.t3_workflow.parametersSchema);
expect(decode({ action: "signal", runId: "run-1", wait: "review " }).wait).toBe("review ");
expect(() => decode({ action: "signal", runId: "run-1", wait: " " })).toThrow();
});
9 changes: 8 additions & 1 deletion apps/server/src/mcp/toolkits/workflow/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ const WorkflowTool = Tool.make("t3_workflow", {
idempotencyKey: Schema.optional(TrimmedNonEmptyString),
runId: Schema.optional(TrimmedNonEmptyString),
status: Schema.optional(WorkflowRunStatus),
wait: Schema.optional(TrimmedNonEmptyString),
// Waits match by exact name, so a name keeps its spaces.
wait: Schema.optional(
Schema.String.check(
Schema.makeFilter((name: string) => name.trim().length > 0, {
expected: "a non-blank string",
}),
),
),
key: Schema.optional(TrimmedNonEmptyString),
channel: Schema.optional(TrimmedNonEmptyString),
value: Schema.optional(Schema.Json),
Expand Down
Loading