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
28 changes: 24 additions & 4 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -982,12 +982,32 @@ class YepCodeMcpServer extends Server {
ScheduleProcessSchema,
request,
async (data) => {
const { identifier, ...rest } = data;

const payload: any = {
...rest,
};
if (payload.input !== undefined) {
// Parse parameters if it's a JSON string
if (
payload.input.parameters &&
typeof payload.input.parameters === "string"
) {
try {
payload.input.parameters = JSON.parse(
payload.input.parameters
);
} catch (error) {
throw new Error(
`Invalid JSON string for parameters: ${error}`
);
}
}
}

const schedule = await this.yepCodeApi.createSchedule(
data.identifier,
{
cron: data.cron,
dateTime: data.dateTime,
}
payload
);
return schedule;
}
Expand Down
112 changes: 96 additions & 16 deletions src/tools/processes-tool-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,66 @@ export const ScheduleProcessSchema = z.object({
identifier: z
.string()
.describe("Unique identifier of the process to schedule (UUID or slug)"),
parameters: z.record(z.any()).optional().describe("Process parameters"),
type: z.enum(["PERIODIC", "ONCE"]).describe("Schedule type"),
cron: z
.string()
.optional()
.describe("Cron expression for PERIODIC schedules"),
.describe(
"Cron expression defining when the process should be executed. Uses standard cron syntax (minute hour day month dayOfWeek)."
),
dateTime: z
.string()
.datetime()
.optional()
.describe(
"Specific date and time when the process should be executed. Used for one-time scheduled executions (ISO 8601 format)."
),
allowConcurrentExecutions: z
.boolean()
.optional()
.describe(
"Whether multiple executions of the same process can run concurrently. If false, new executions will be queued if one is already running."
),
input: z
.object({
parameters: z
.string()
.optional()
.describe(
"JSON string containing the input parameters for the process execution. Must match the process parameter schema."
),
tag: z
.string()
.optional()
.describe("A version tag or an alias of the version"),
comment: z
.string()
.optional()
.describe(
"Optional comment or description for this execution. Useful for tracking and debugging purposes."
),
settings: z
.object({
agentPoolSlug: z
.string()
.optional()
.describe("Agent pool where to execute"),
callbackUrl: z
.string()
.url()
.optional()
.describe(
"URL to receive execution results upon completion (success or failure)"
),
})
.optional()
.describe(
"Execution-specific settings and configuration options. Overrides default process settings for this execution."
),
})
.optional()
.describe("Date and time for ONCE schedules (ISO format)"),
settings: z.record(z.any()).optional().describe("Schedule settings"),
.describe(
"Input parameters and settings for the scheduled process execution. Defines what parameters will be passed to the process when it runs."
),
});

// Tool names
Expand Down Expand Up @@ -695,26 +744,57 @@ export const processesToolDefinitions = [
description:
"Unique identifier of the process to schedule (UUID or slug)",
},
parameters: {
type: "object",
description: "Process parameters",
},
type: {
type: "string",
enum: ["PERIODIC", "ONCE"],
description: "Schedule type",
},
cron: {
type: "string",
description: "Cron expression for PERIODIC schedules",
},
dateTime: {
type: "string",
format: "date-time",
description: "Date and time for ONCE schedules (ISO format)",
},
settings: {
allowConcurrentExecutions: {
type: "boolean",
description:
"Whether multiple executions of the same process can run concurrently. If false, new executions will be queued if one is already running.",
},
input: {
type: "object",
description: "Schedule settings",
description:
"Input parameters and settings for the scheduled process execution. Defines what parameters will be passed to the process when it runs.",
properties: {
parameters: {
type: "string",
description:
"JSON string containing the input parameters for the process execution. Must match the process parameter schema.",
},
tag: {
type: "string",
description: "A version tag or an alias of the version",
},
comment: {
type: "string",
description:
"Optional comment or description for this execution. Useful for tracking and debugging purposes.",
},
settings: {
type: "object",
description:
"Execution-specific settings and configuration options. Overrides default process settings for this execution.",
properties: {
agentPoolSlug: {
type: "string",
description: "Agent pool where to execute",
},
callbackUrl: {
type: "string",
format: "uri",
description:
"URL to receive execution results upon completion (success or failure)",
},
},
},
},
},
},
required: ["identifier", "type"],
Expand Down