@ferrfleet/mcp 10.18.0 → 10.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -192,6 +192,21 @@ describe('workflow and event rule tools', () => {
192
192
  expect(accepts('create_workflow', 'entries', [noStarts])).toBe(false);
193
193
  expect(accepts('create_workflow', 'outputs', [noFrom])).toBe(false);
194
194
  });
195
+ it('accepts from as a step id or a non-empty list of distinct step ids', () => {
196
+ expect(accepts('create_workflow', 'outputs', [{ ...issueOutput, from: 'review' }])).toBe(true);
197
+ expect(accepts('create_workflow', 'outputs', [{ ...issueOutput, from: ['review', 'verify'] }])).toBe(true);
198
+ expect(accepts('update_workflow', 'outputs', [{ ...issueOutput, from: ['review'] }])).toBe(true);
199
+ });
200
+ it('refuses an empty, duplicated or malformed from', () => {
201
+ for (const from of [[], ['review', 'review'], [''], ['review', 3], '', 3, null]) {
202
+ expect(accepts('create_workflow', 'outputs', [{ ...issueOutput, from }]), String(from)).toBe(false);
203
+ }
204
+ });
205
+ it('create_workflow posts a list from unchanged', async () => {
206
+ const output = { ...issueOutput, from: ['review', 'verify'] };
207
+ await handlers.get('create_workflow')({ name: 'wf', steps: [step], outputs: [output] });
208
+ expect(lastCall().body).toMatchObject({ outputs: [output] });
209
+ });
195
210
  it('caps entries and outputs at 10', () => {
196
211
  const entries = Array.from({ length: 11 }, (_, i) => ({ ...cronEntry, id: `e${i}` }));
197
212
  const outputs = Array.from({ length: 11 }, (_, i) => ({ ...issueOutput, id: `o${i}` }));
@@ -235,7 +235,54 @@ describe('ferrfleet tools', () => {
235
235
  const keys = Object.keys(schemas.get('create_agent'));
236
236
  expect(keys).not.toContain('runner_mode');
237
237
  expect(keys).not.toContain('enabled');
238
- expect(keys).not.toContain('options');
238
+ });
239
+ it('create_agent forwards options and capabilities unchanged', async () => {
240
+ const options = { max_turns: 5 };
241
+ const capabilities = ['code_review', 'review_followup'];
242
+ await handlers.get('create_agent')({
243
+ id: 'bot',
244
+ name: 'Bot',
245
+ prompt: 'p',
246
+ options,
247
+ capabilities,
248
+ });
249
+ expect(lastCall().body).toEqual({ id: 'bot', name: 'Bot', prompt: 'p', options, capabilities });
250
+ });
251
+ it('create_agent sends an empty capability list instead of dropping it', async () => {
252
+ await handlers.get('create_agent')({ id: 'bot', name: 'Bot', prompt: 'p', capabilities: [] });
253
+ expect(lastCall().body).toEqual({ id: 'bot', name: 'Bot', prompt: 'p', capabilities: [] });
254
+ });
255
+ it('update_agent patches capabilities alone', async () => {
256
+ await handlers.get('update_agent')({ agent_id: 'a1', capabilities: ['debug_action'] });
257
+ expect(lastCall().body).toEqual({ capabilities: ['debug_action'] });
258
+ });
259
+ it('update_agent sends an empty capability list as a real change', async () => {
260
+ const result = await handlers.get('update_agent')({ agent_id: 'a1', capabilities: [] });
261
+ expect(result).not.toMatchObject({ isError: true });
262
+ expect(lastCall().body).toEqual({ capabilities: [] });
263
+ });
264
+ it('update_agent omits capabilities when absent', async () => {
265
+ await handlers.get('update_agent')({ agent_id: 'a1', enabled: true });
266
+ expect(lastCall().body).toEqual({ enabled: true });
267
+ });
268
+ it.each(['create_agent', 'update_agent'])('%s only accepts known capabilities', (tool) => {
269
+ const capabilities = schemas.get(tool).capabilities;
270
+ for (const value of [
271
+ 'code_review',
272
+ 'debug_action',
273
+ 'ticket_implementation',
274
+ 'review_response',
275
+ 'review_followup',
276
+ ]) {
277
+ expect(capabilities.safeParse([value]).success, value).toBe(true);
278
+ }
279
+ expect(capabilities.safeParse([]).success).toBe(true);
280
+ expect(capabilities.safeParse(undefined).success).toBe(true);
281
+ expect(capabilities.safeParse(['deploy']).success).toBe(false);
282
+ expect(capabilities.safeParse(['Code_Review']).success).toBe(false);
283
+ expect(capabilities.safeParse(['code_review', 'deploy']).success).toBe(false);
284
+ expect(capabilities.safeParse('code_review').success).toBe(false);
285
+ expect(capabilities.safeParse(null).success).toBe(false);
239
286
  });
240
287
  it('update_agent patches the agent with only the fields given', async () => {
241
288
  await handlers.get('update_agent')({ agent_id: 'a1', runner_mode: 'external' });
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/tools/agents.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAc1E,eAAO,MAAM,gBAAgB,QAAsC,CAAC;AAEpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAqLnD"}
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/tools/agents.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAqB1E,eAAO,MAAM,gBAAgB,QAAsC,CAAC;AAEpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAgMnD"}
@@ -2,6 +2,13 @@ import { z } from 'zod';
2
2
  import { getToken, toToolText } from '@ferrlabs/mcp-core';
3
3
  import { fleetRequest, orgIdSchema } from '../api-base.js';
4
4
  const RUNNER_MODES = ['managed', 'external'];
5
+ const AGENT_CAPABILITIES = [
6
+ 'code_review',
7
+ 'debug_action',
8
+ 'ticket_implementation',
9
+ 'review_response',
10
+ 'review_followup',
11
+ ];
5
12
  export const AGENT_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$/;
6
13
  export function registerAgentTools(server) {
7
14
  server.tool('list_agents', 'List FerrFleet agents available to the authenticated user (marketplace + custom).', { org_id: orgIdSchema }, async ({ org_id }) => {
@@ -48,7 +55,7 @@ export function registerAgentTools(server) {
48
55
  content: [{ type: 'text', text: toToolText(run) }],
49
56
  };
50
57
  });
51
- server.tool('create_agent', 'Create a FerrFleet agent in the organization. The agent starts with default options and runner_mode=managed; use update_agent to change those or to set enabled.', {
58
+ server.tool('create_agent', 'Create a FerrFleet agent in the organization. The agent starts with default options unless you pass options, and runner_mode=managed; use update_agent to change runner_mode or to set enabled.', {
52
59
  id: z
53
60
  .string()
54
61
  .regex(AGENT_ID_PATTERN)
@@ -75,6 +82,11 @@ export function registerAgentTools(server) {
75
82
  .max(2048)
76
83
  .optional()
77
84
  .describe('Webhook notified when a run finishes'),
85
+ options: z.record(z.string(), z.unknown()).optional().describe('Agent options object'),
86
+ capabilities: z
87
+ .array(z.enum(AGENT_CAPABILITIES))
88
+ .optional()
89
+ .describe('Capabilities the agent can be assigned; duplicates are removed'),
78
90
  }, async ({ org_id, ...fields }) => {
79
91
  const body = Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined));
80
92
  const token = await getToken();
@@ -116,6 +128,10 @@ export function registerAgentTools(server) {
116
128
  .record(z.string(), z.unknown())
117
129
  .optional()
118
130
  .describe('Replaces the whole options object; it is not merged with the existing one'),
131
+ capabilities: z
132
+ .array(z.enum(AGENT_CAPABILITIES))
133
+ .optional()
134
+ .describe('Replaces the whole capability list, it is not merged with the existing one; [] clears it; omit to leave it unchanged; duplicates are removed'),
119
135
  runner_mode: z
120
136
  .enum(RUNNER_MODES)
121
137
  .optional()
@@ -1 +1 @@
1
- {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/tools/workflows.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAmH9D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QAqItD"}
1
+ {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/tools/workflows.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA0H9D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QAqItD"}
@@ -60,7 +60,12 @@ const outputSchema = z.strictObject({
60
60
  .string()
61
61
  .min(1)
62
62
  .describe('Output id, unique among the steps, entries and outputs of the workflow'),
63
- from: z.string().min(1).describe('Id of the step whose result is delivered'),
63
+ from: z
64
+ .union([z.string().min(1), z.array(z.string().min(1)).min(1)])
65
+ .refine((from) => typeof from === 'string' || new Set(from).size === from.length, {
66
+ message: 'Step ids must be unique',
67
+ })
68
+ .describe('Id of the step whose result is delivered, or a non-empty list of distinct step ids: the output waits for all of them, ignores skipped ones and delivers the last listed step that completed with a body'),
64
69
  kind: z.enum(OUTPUT_KINDS).describe('Where the result goes'),
65
70
  connector_id: z
66
71
  .string()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferrfleet/mcp",
3
- "version": "10.18.0",
3
+ "version": "10.20.0",
4
4
  "description": "Model Context Protocol server for FerrFleet: agents, runs, skills",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",