@ferrfleet/mcp 10.19.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.
@@ -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()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferrfleet/mcp",
3
- "version": "10.19.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",