Skip to content

Commit 6f8c771

Browse files
committed
Fix scheduleProcess tool definitions
Restructure schema to nest parameters under input object and add JSON parsing support.
1 parent 28c994f commit 6f8c771

2 files changed

Lines changed: 120 additions & 15 deletions

File tree

src/server.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -982,12 +982,32 @@ class YepCodeMcpServer extends Server {
982982
ScheduleProcessSchema,
983983
request,
984984
async (data) => {
985+
const { identifier, ...rest } = data;
986+
987+
const payload: any = {
988+
...rest,
989+
};
990+
if (payload.input !== undefined) {
991+
// Parse parameters if it's a JSON string
992+
if (
993+
payload.input.parameters &&
994+
typeof payload.input.parameters === "string"
995+
) {
996+
try {
997+
payload.input.parameters = JSON.parse(
998+
payload.input.parameters
999+
);
1000+
} catch (error) {
1001+
throw new Error(
1002+
`Invalid JSON string for parameters: ${error}`
1003+
);
1004+
}
1005+
}
1006+
}
1007+
9851008
const schedule = await this.yepCodeApi.createSchedule(
9861009
data.identifier,
987-
{
988-
cron: data.cron,
989-
dateTime: data.dateTime,
990-
}
1010+
payload
9911011
);
9921012
return schedule;
9931013
}

src/tools/processes-tool-definitions.ts

Lines changed: 96 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -339,17 +339,66 @@ export const ScheduleProcessSchema = z.object({
339339
identifier: z
340340
.string()
341341
.describe("Unique identifier of the process to schedule (UUID or slug)"),
342-
parameters: z.record(z.any()).optional().describe("Process parameters"),
343-
type: z.enum(["PERIODIC", "ONCE"]).describe("Schedule type"),
344342
cron: z
345343
.string()
346344
.optional()
347-
.describe("Cron expression for PERIODIC schedules"),
345+
.describe(
346+
"Cron expression defining when the process should be executed. Uses standard cron syntax (minute hour day month dayOfWeek)."
347+
),
348348
dateTime: z
349349
.string()
350+
.datetime()
351+
.optional()
352+
.describe(
353+
"Specific date and time when the process should be executed. Used for one-time scheduled executions (ISO 8601 format)."
354+
),
355+
allowConcurrentExecutions: z
356+
.boolean()
357+
.optional()
358+
.describe(
359+
"Whether multiple executions of the same process can run concurrently. If false, new executions will be queued if one is already running."
360+
),
361+
input: z
362+
.object({
363+
parameters: z
364+
.string()
365+
.optional()
366+
.describe(
367+
"JSON string containing the input parameters for the process execution. Must match the process parameter schema."
368+
),
369+
tag: z
370+
.string()
371+
.optional()
372+
.describe("A version tag or an alias of the version"),
373+
comment: z
374+
.string()
375+
.optional()
376+
.describe(
377+
"Optional comment or description for this execution. Useful for tracking and debugging purposes."
378+
),
379+
settings: z
380+
.object({
381+
agentPoolSlug: z
382+
.string()
383+
.optional()
384+
.describe("Agent pool where to execute"),
385+
callbackUrl: z
386+
.string()
387+
.url()
388+
.optional()
389+
.describe(
390+
"URL to receive execution results upon completion (success or failure)"
391+
),
392+
})
393+
.optional()
394+
.describe(
395+
"Execution-specific settings and configuration options. Overrides default process settings for this execution."
396+
),
397+
})
350398
.optional()
351-
.describe("Date and time for ONCE schedules (ISO format)"),
352-
settings: z.record(z.any()).optional().describe("Schedule settings"),
399+
.describe(
400+
"Input parameters and settings for the scheduled process execution. Defines what parameters will be passed to the process when it runs."
401+
),
353402
});
354403

355404
// Tool names
@@ -695,10 +744,6 @@ export const processesToolDefinitions = [
695744
description:
696745
"Unique identifier of the process to schedule (UUID or slug)",
697746
},
698-
parameters: {
699-
type: "object",
700-
description: "Process parameters",
701-
},
702747
type: {
703748
type: "string",
704749
enum: ["PERIODIC", "ONCE"],
@@ -710,11 +755,51 @@ export const processesToolDefinitions = [
710755
},
711756
dateTime: {
712757
type: "string",
758+
format: "date-time",
713759
description: "Date and time for ONCE schedules (ISO format)",
714760
},
715-
settings: {
761+
allowConcurrentExecutions: {
762+
type: "boolean",
763+
description:
764+
"Whether multiple executions of the same process can run concurrently. If false, new executions will be queued if one is already running.",
765+
},
766+
input: {
716767
type: "object",
717-
description: "Schedule settings",
768+
description:
769+
"Input parameters and settings for the scheduled process execution. Defines what parameters will be passed to the process when it runs.",
770+
properties: {
771+
parameters: {
772+
type: "string",
773+
description:
774+
"JSON string containing the input parameters for the process execution. Must match the process parameter schema.",
775+
},
776+
tag: {
777+
type: "string",
778+
description: "A version tag or an alias of the version",
779+
},
780+
comment: {
781+
type: "string",
782+
description:
783+
"Optional comment or description for this execution. Useful for tracking and debugging purposes.",
784+
},
785+
settings: {
786+
type: "object",
787+
description:
788+
"Execution-specific settings and configuration options. Overrides default process settings for this execution.",
789+
properties: {
790+
agentPoolSlug: {
791+
type: "string",
792+
description: "Agent pool where to execute",
793+
},
794+
callbackUrl: {
795+
type: "string",
796+
format: "uri",
797+
description:
798+
"URL to receive execution results upon completion (success or failure)",
799+
},
800+
},
801+
},
802+
},
718803
},
719804
},
720805
required: ["identifier", "type"],

0 commit comments

Comments
 (0)