Skip to content

Commit 49457b8

Browse files
authored
Merge pull request #13 from yepcode/feature/split-yc_api-tag
Split yc_api tag into basic and full variants
2 parents 9aab79e + c272347 commit 49457b8

4 files changed

Lines changed: 126 additions & 51 deletions

File tree

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ You can control which tools are enabled by setting the `YEPCODE_MCP_TOOLS` envir
160160

161161
**Built-in tool categories:**
162162
- `run_code`: Enables the code execution tool
163-
- `yc_api`: Enables all API management tools (processes, schedules, variables, storage, executions, modules)
163+
- `yc_api`: Enables all basic API management tools (processes, schedules, variables, storage, executions, modules)
164+
- `yc_api_full`: Enables all API management tools including version-related tools (extends `yc_api` with additional process and module version management tools)
164165

165166
**Process tags:**
166167
- Any tag used in your YepCode processes (e.g., `mcp-tool`, `core`, `automation`, etc.)
@@ -196,7 +197,8 @@ If not specified, all built-in tools are enabled by default, but no process tool
196197
```
197198

198199
**Example scenarios:**
199-
- `YEPCODE_MCP_TOOLS=run_code,yc_api` - Enables built-in code execution and API management tools
200+
- `YEPCODE_MCP_TOOLS=run_code,yc_api` - Enables built-in code execution and basic API management tools
201+
- `YEPCODE_MCP_TOOLS=run_code,yc_api_full` - Enables built-in code execution and all API management tools (including version management)
200202
- `YEPCODE_MCP_TOOLS=core,automation` - Only exposes processes tagged with "core" or "automation" as tools
201203
- `YEPCODE_MCP_TOOLS=run_code,yc_api,core` - Enables built-in tools plus all processes tagged with "core"
202204

@@ -348,14 +350,21 @@ For more information about process tags, see our [process tags documentation](ht
348350

349351
### API Management Tools
350352

351-
The `yc_api` tool category provides comprehensive API access to manage all aspects of your YepCode workspace:
353+
The API management tool categories (`yc_api` and `yc_api_full`) provide comprehensive API access to manage all aspects of your YepCode workspace:
354+
355+
**Basic API tools (`yc_api`):**
356+
The `yc_api` tag enables standard API management tools for core operations across your workspace.
357+
358+
**Extended API tools (`yc_api_full`):**
359+
The `yc_api_full` tag includes everything from `yc_api` plus additional tools for managing process and module versions.
352360

353361
**Processes Management:**
354362
- `get_processes` - List processes with optional filtering
355363
- `create_process` - Create new processes with source code
356364
- `get_process` - Get process details
365+
- `update_process` - Update an existing process
357366
- `delete_process` - Delete a process
358-
- `get_process_versions` - Get process versions
367+
- `get_process_versions` - Get process versions (requires `yc_api_full`)
359368
- `execute_process_async` - Execute a process asynchronously
360369
- `execute_process_sync` - Execute a process synchronously
361370
- `schedule_process` - Schedule a process to run automatically
@@ -391,7 +400,10 @@ The `yc_api` tool category provides comprehensive API access to manage all aspec
391400
- `create_module` - Create a new module
392401
- `get_module` - Get module details
393402
- `delete_module` - Delete a module
394-
- `get_module_versions` - Get module versions
403+
- `get_module_versions` - Get module versions (requires `yc_api_full`)
404+
- `get_module_version` - Get a specific module version (requires `yc_api_full`)
405+
- `delete_module_version` - Delete a module version (requires `yc_api_full`)
406+
- `get_module_aliases` - Get module version aliases (requires `yc_api_full`)
395407

396408
## License
397409

src/server.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ import {
6464
ExecuteProcessSyncSchema,
6565
ScheduleProcessSchema,
6666
processesToolDefinitions,
67+
processesWithVersionsToolDefinitions,
6768
processesToolNames,
6869
} from "./tools/processes-tool-definitions.js";
6970
import {
@@ -85,13 +86,17 @@ import {
8586
DeleteModuleVersionSchema,
8687
GetModuleAliasesSchema,
8788
modulesToolDefinitions,
89+
modulesWithVersionsToolDefinitions,
8890
modulesToolNames,
8991
} from "./tools/modules-tool-definitions.js";
9092

9193
const RUN_PROCESS_TOOL_NAME_PREFIX = "yc_";
9294
const RUN_PROCESS_TOOL_TAG = "mcp-tool";
9395
const RUN_CODE_TOOL_TAG = "run_code";
94-
const API_TOOL_TAG = "yc_api";
96+
const API_TOOL_TAGS = {
97+
DEFAULT: "yc_api",
98+
FULL: "yc_api_full",
99+
};
95100

96101
const DEFAULT_TOOL_TAGS = [RUN_CODE_TOOL_TAG, RUN_PROCESS_TOOL_TAG];
97102

@@ -261,14 +266,21 @@ class YepCodeMcpServer extends Server {
261266
this.setRequestHandler(ListToolsRequestSchema, async () => {
262267
this.logger.info(`Handling ListTools request`);
263268
const tools = [];
264-
if (this.tools.includes(API_TOOL_TAG)) {
269+
if (
270+
this.tools.includes(API_TOOL_TAGS.DEFAULT) ||
271+
this.tools.includes(API_TOOL_TAGS.FULL)
272+
) {
265273
tools.push(...storageToolDefinitions);
266274
tools.push(...variablesToolDefinitions);
267275
tools.push(...schedulesToolDefinitions);
268276
tools.push(...processesToolDefinitions);
269277
tools.push(...executionsToolDefinitions);
270278
tools.push(...modulesToolDefinitions);
271279
}
280+
if (this.tools.includes(API_TOOL_TAGS.FULL)) {
281+
tools.push(...processesWithVersionsToolDefinitions);
282+
tools.push(...modulesWithVersionsToolDefinitions);
283+
}
272284
if (this.tools.includes(RUN_CODE_TOOL_TAG)) {
273285
const envVars = await this.yepCodeEnv.getEnvVars();
274286
tools.push(...(await runCodeToolDefinitions(envVars)));

src/tools/modules-tool-definitions.ts

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,21 @@ import { z } from "zod";
22

33
// Schema for getting modules with pagination
44
export const GetModulesSchema = z.object({
5-
page: z.number().int().min(0).default(0).optional().describe("Page number for pagination (0-based index)"),
6-
limit: z.number().int().min(1).max(100).default(10).optional().describe("Maximum number of modules to retrieve per page"),
5+
page: z
6+
.number()
7+
.int()
8+
.min(0)
9+
.default(0)
10+
.optional()
11+
.describe("Page number for pagination (0-based index)"),
12+
limit: z
13+
.number()
14+
.int()
15+
.min(1)
16+
.max(100)
17+
.default(10)
18+
.optional()
19+
.describe("Maximum number of modules to retrieve per page"),
720
});
821

922
// Schema for creating a module
@@ -18,19 +31,34 @@ export const CreateModuleSchema = z.object({
1831

1932
// Schema for getting a specific module
2033
export const GetModuleSchema = z.object({
21-
id: z.string().describe("Unique identifier (UUID) of the script library module to retrieve"),
34+
id: z
35+
.string()
36+
.describe(
37+
"Unique identifier (UUID) of the script library module to retrieve"
38+
),
2239
});
2340

2441
// Schema for deleting a module
2542
export const DeleteModuleSchema = z.object({
26-
id: z.string().describe("Unique identifier (UUID) of the script library module to delete"),
43+
id: z
44+
.string()
45+
.describe(
46+
"Unique identifier (UUID) of the script library module to delete"
47+
),
2748
});
2849

2950
// Schema for getting module versions
3051
export const GetModuleVersionsSchema = z.object({
3152
moduleId: z.string().describe("Module ID"),
3253
page: z.number().int().min(0).default(0).optional().describe("Page number"),
33-
limit: z.number().int().min(1).max(100).default(10).optional().describe("Amount of items to retrieve"),
54+
limit: z
55+
.number()
56+
.int()
57+
.min(1)
58+
.max(100)
59+
.default(10)
60+
.optional()
61+
.describe("Amount of items to retrieve"),
3462
});
3563

3664
// Schema for getting a specific module version
@@ -50,7 +78,14 @@ export const GetModuleAliasesSchema = z.object({
5078
moduleId: z.string().describe("Module ID"),
5179
versionId: z.string().optional().describe("Version ID"),
5280
page: z.number().int().min(0).default(0).optional().describe("Page number"),
53-
limit: z.number().int().min(1).max(100).default(10).optional().describe("Amount of items to retrieve"),
81+
limit: z
82+
.number()
83+
.int()
84+
.min(1)
85+
.max(100)
86+
.default(10)
87+
.optional()
88+
.describe("Amount of items to retrieve"),
5489
});
5590

5691
// Tool names
@@ -70,7 +105,8 @@ export const modulesToolDefinitions = [
70105
{
71106
name: modulesToolNames.getModules,
72107
title: "Get Modules",
73-
description: "Retrieves a paginated list of script library modules. Modules are reusable code libraries that can be imported and used across different processes.",
108+
description:
109+
"Retrieves a paginated list of script library modules. Modules are reusable code libraries that can be imported and used across different processes.",
74110
inputSchema: {
75111
type: "object",
76112
properties: {
@@ -92,7 +128,8 @@ export const modulesToolDefinitions = [
92128
{
93129
name: modulesToolNames.createModule,
94130
title: "Create Module",
95-
description: "Creates a new script library module with source code and metadata. Modules can be written in JavaScript or Python and can be imported by processes.",
131+
description:
132+
"Creates a new script library module with source code and metadata. Modules can be written in JavaScript or Python and can be imported by processes.",
96133
inputSchema: {
97134
type: "object",
98135
properties: {
@@ -129,13 +166,15 @@ export const modulesToolDefinitions = [
129166
{
130167
name: modulesToolNames.getModule,
131168
title: "Get Module",
132-
description: "Retrieves detailed information about a specific script library module including its source code, metadata, and version information.",
169+
description:
170+
"Retrieves detailed information about a specific script library module including its source code, metadata, and version information.",
133171
inputSchema: {
134172
type: "object",
135173
properties: {
136174
id: {
137175
type: "string",
138-
description: "Unique identifier (UUID) of the script library module to retrieve",
176+
description:
177+
"Unique identifier (UUID) of the script library module to retrieve",
139178
},
140179
},
141180
required: ["id"],
@@ -144,22 +183,28 @@ export const modulesToolDefinitions = [
144183
{
145184
name: modulesToolNames.deleteModule,
146185
title: "Delete Module",
147-
description: "Deletes a script library module and all its versions. This action cannot be undone.",
186+
description:
187+
"Deletes a script library module and all its versions. This action cannot be undone.",
148188
inputSchema: {
149189
type: "object",
150190
properties: {
151191
id: {
152192
type: "string",
153-
description: "Unique identifier (UUID) of the script library module to delete",
193+
description:
194+
"Unique identifier (UUID) of the script library module to delete",
154195
},
155196
},
156197
required: ["id"],
157198
},
158199
},
200+
];
201+
202+
export const modulesWithVersionsToolDefinitions = [
159203
{
160204
name: modulesToolNames.getModuleVersions,
161205
title: "Get Module Versions",
162-
description: "Retrieves a paginated list of versions for a specific module.",
206+
description:
207+
"Retrieves a paginated list of versions for a specific module.",
163208
inputSchema: {
164209
type: "object",
165210
properties: {
@@ -186,7 +231,8 @@ export const modulesToolDefinitions = [
186231
{
187232
name: modulesToolNames.getModuleVersion,
188233
title: "Get Module Version",
189-
description: "Retrieves detailed information about a specific module version.",
234+
description:
235+
"Retrieves detailed information about a specific module version.",
190236
inputSchema: {
191237
type: "object",
192238
properties: {
@@ -205,7 +251,8 @@ export const modulesToolDefinitions = [
205251
{
206252
name: modulesToolNames.deleteModuleVersion,
207253
title: "Delete Module Version",
208-
description: "Deletes a specific module version. This action cannot be undone.",
254+
description:
255+
"Deletes a specific module version. This action cannot be undone.",
209256
inputSchema: {
210257
type: "object",
211258
properties: {
@@ -224,7 +271,8 @@ export const modulesToolDefinitions = [
224271
{
225272
name: modulesToolNames.getModuleAliases,
226273
title: "Get Module Aliases",
227-
description: "Retrieves a paginated list of version aliases for a specific module.",
274+
description:
275+
"Retrieves a paginated list of version aliases for a specific module.",
228276
inputSchema: {
229277
type: "object",
230278
properties: {

src/tools/processes-tool-definitions.ts

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -499,34 +499,6 @@ export const processesToolDefinitions = [
499499
required: ["identifier"],
500500
},
501501
},
502-
{
503-
name: processesToolNames.getProcessVersions,
504-
title: "Get Process Versions",
505-
description:
506-
"Retrieves a paginated list of versions for a specific process.",
507-
inputSchema: {
508-
type: "object",
509-
properties: {
510-
processId: {
511-
type: "string",
512-
description: "Process ID",
513-
},
514-
page: {
515-
type: "integer",
516-
format: "int32",
517-
default: 0,
518-
description: "Page number",
519-
},
520-
limit: {
521-
type: "integer",
522-
format: "int32",
523-
default: 10,
524-
description: "Amount of items to retrieve",
525-
},
526-
},
527-
required: ["processId"],
528-
},
529-
},
530502
{
531503
name: processesToolNames.executeProcessAsync,
532504
title: "Execute Process Async",
@@ -669,3 +641,34 @@ export const processesToolDefinitions = [
669641
},
670642
},
671643
];
644+
645+
export const processesWithVersionsToolDefinitions = [
646+
{
647+
name: processesToolNames.getProcessVersions,
648+
title: "Get Process Versions",
649+
description:
650+
"Retrieves a paginated list of versions for a specific process.",
651+
inputSchema: {
652+
type: "object",
653+
properties: {
654+
processId: {
655+
type: "string",
656+
description: "Process ID",
657+
},
658+
page: {
659+
type: "integer",
660+
format: "int32",
661+
default: 0,
662+
description: "Page number",
663+
},
664+
limit: {
665+
type: "integer",
666+
format: "int32",
667+
default: 10,
668+
description: "Amount of items to retrieve",
669+
},
670+
},
671+
required: ["processId"],
672+
},
673+
},
674+
];

0 commit comments

Comments
 (0)