Skip to content

Commit bd050b2

Browse files
authored
Merge pull request #20 from yepcode/bug/YEP-3039
YEP-3039 Create and update schedule mcp tools doesn't work
2 parents 28c994f + 46737e7 commit bd050b2

2 files changed

Lines changed: 120 additions & 20 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 & 16 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,26 +744,57 @@ 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-
},
702-
type: {
703-
type: "string",
704-
enum: ["PERIODIC", "ONCE"],
705-
description: "Schedule type",
706-
},
707747
cron: {
708748
type: "string",
709749
description: "Cron expression for PERIODIC schedules",
710750
},
711751
dateTime: {
712752
type: "string",
753+
format: "date-time",
713754
description: "Date and time for ONCE schedules (ISO format)",
714755
},
715-
settings: {
756+
allowConcurrentExecutions: {
757+
type: "boolean",
758+
description:
759+
"Whether multiple executions of the same process can run concurrently. If false, new executions will be queued if one is already running.",
760+
},
761+
input: {
716762
type: "object",
717-
description: "Schedule settings",
763+
description:
764+
"Input parameters and settings for the scheduled process execution. Defines what parameters will be passed to the process when it runs.",
765+
properties: {
766+
parameters: {
767+
type: "string",
768+
description:
769+
"JSON string containing the input parameters for the process execution. Must match the process parameter schema.",
770+
},
771+
tag: {
772+
type: "string",
773+
description: "A version tag or an alias of the version",
774+
},
775+
comment: {
776+
type: "string",
777+
description:
778+
"Optional comment or description for this execution. Useful for tracking and debugging purposes.",
779+
},
780+
settings: {
781+
type: "object",
782+
description:
783+
"Execution-specific settings and configuration options. Overrides default process settings for this execution.",
784+
properties: {
785+
agentPoolSlug: {
786+
type: "string",
787+
description: "Agent pool where to execute",
788+
},
789+
callbackUrl: {
790+
type: "string",
791+
format: "uri",
792+
description:
793+
"URL to receive execution results upon completion (success or failure)",
794+
},
795+
},
796+
},
797+
},
718798
},
719799
},
720800
required: ["identifier", "type"],

0 commit comments

Comments
 (0)