Skip to content

Commit 0e4015f

Browse files
committed
fix: standardize formatting by removing trailing commas in function parameters
1 parent ab6b15f commit 0e4015f

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

packages/core/src/compose.ts

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class ComposableMCPServer extends Server {
7070
_toolName: string,
7171
args: unknown,
7272
_mode: "input" | "output",
73-
_originalArgs?: unknown,
73+
_originalArgs?: unknown
7474
): unknown {
7575
// For now, just return args unchanged
7676
// TODO: Implement transformResult hooks for runtime transformation
@@ -109,7 +109,7 @@ export class ComposableMCPServer extends Server {
109109
description: string,
110110
paramsSchema: Schema<T>,
111111
cb: (args: T, extra?: unknown) => unknown,
112-
options: { internal?: boolean; plugins?: ToolPlugin[] } = {},
112+
options: { internal?: boolean; plugins?: ToolPlugin[] } = {}
113113
) {
114114
this.toolRegistry.set(name, {
115115
callback: cb as ToolCallback,
@@ -159,7 +159,7 @@ export class ComposableMCPServer extends Server {
159159
toolName,
160160
result,
161161
"output",
162-
args,
162+
args
163163
) as CallToolResult;
164164
});
165165
}
@@ -208,7 +208,7 @@ export class ComposableMCPServer extends Server {
208208
const processedArgs = this.applyPluginTransforms(
209209
resolvedName,
210210
args,
211-
"input",
211+
"input"
212212
);
213213
const result = await callback(processedArgs);
214214
return this.applyPluginTransforms(resolvedName, result, "output", args);
@@ -242,7 +242,7 @@ export class ComposableMCPServer extends Server {
242242
const hiddenSet = new Set(this.getHiddenToolNames());
243243

244244
return allRegistered.filter(
245-
(n) => !publicSet.has(n) && !internalSet.has(n) && !hiddenSet.has(n),
245+
(n) => !publicSet.has(n) && !internalSet.has(n) && !hiddenSet.has(n)
246246
);
247247
}
248248

@@ -259,7 +259,7 @@ export class ComposableMCPServer extends Server {
259259
* Get internal tool schema by name
260260
*/
261261
getInternalToolSchema(
262-
name: string,
262+
name: string
263263
): { description: string; schema: JSONSchema } | undefined {
264264
const tool = this.toolRegistry.get(name);
265265
const config = this.toolConfigs.get(name);
@@ -372,10 +372,10 @@ export class ComposableMCPServer extends Server {
372372
private async applyTransformToolHooks(
373373
tool: ComposedTool,
374374
toolName: string,
375-
mode: "agentic" | "agentic_workflow",
375+
mode: "agentic" | "agentic_workflow"
376376
): Promise<ComposedTool> {
377377
const transformPlugins = this.globalPlugins.filter(
378-
(p) => p.transformTool && shouldApplyPlugin(p, mode),
378+
(p) => p.transformTool && shouldApplyPlugin(p, mode)
379379
);
380380

381381
if (transformPlugins.length === 0) {
@@ -412,7 +412,7 @@ export class ComposableMCPServer extends Server {
412412
*/
413413
private async processToolsWithPlugins(
414414
externalTools: Record<string, ComposedTool>,
415-
mode: "agentic" | "agentic_workflow",
415+
mode: "agentic" | "agentic_workflow"
416416
): Promise<void> {
417417
for (const [toolId, toolData] of this.toolRegistry.entries()) {
418418
const defaultSchema = {
@@ -430,7 +430,7 @@ export class ComposableMCPServer extends Server {
430430
const processedTool = await this.applyTransformToolHooks(
431431
tempTool,
432432
toolId,
433-
mode,
433+
mode
434434
);
435435

436436
this.toolRegistry.set(toolId, {
@@ -450,7 +450,7 @@ export class ComposableMCPServer extends Server {
450450
toolId,
451451
processedTool,
452452
this,
453-
externalTools,
453+
externalTools
454454
);
455455
}
456456
} catch {
@@ -466,10 +466,10 @@ export class ComposableMCPServer extends Server {
466466
* Trigger composeEnd hooks for all plugins
467467
*/
468468
private async triggerComposeEndHooks(
469-
context: ComposeEndContext,
469+
context: ComposeEndContext
470470
): Promise<void> {
471471
const endPlugins = this.globalPlugins.filter(
472-
(p) => p.composeEnd && shouldApplyPlugin(p, context.mode),
472+
(p) => p.composeEnd && shouldApplyPlugin(p, context.mode)
473473
);
474474

475475
for (const plugin of endPlugins) {
@@ -483,7 +483,7 @@ export class ComposableMCPServer extends Server {
483483
name: string | null,
484484
description: string,
485485
depsConfig: z.infer<typeof McpSettingsSchema> = { mcpServers: {} },
486-
options: ComposeDefinition["options"] = { mode: "agentic" },
486+
options: ComposeDefinition["options"] = { mode: "agentic" }
487487
) {
488488
const refDesc = options.refs?.join("") ?? "";
489489
const { tagToResults } = parseTags(description + refDesc, ["tool", "fn"]);
@@ -550,7 +550,7 @@ export class ComposableMCPServer extends Server {
550550
tool.attribs.name === toolId
551551
);
552552
});
553-
},
553+
}
554554
)) as {
555555
tools: Record<string, ComposedTool>;
556556
cleanupClients: () => Promise<void>;
@@ -595,7 +595,7 @@ export class ComposableMCPServer extends Server {
595595
const contextToolNames = toolNameToDetailList
596596
.map(([name]) => name)
597597
.filter(
598-
(n) => !globalToolNames.includes(n) && !hideToolNames.includes(n),
598+
(n) => !globalToolNames.includes(n) && !hideToolNames.includes(n)
599599
);
600600

601601
// For agentic interface: external tools (non-hidden) + internal tools
@@ -604,11 +604,18 @@ export class ComposableMCPServer extends Server {
604604
// Add global tools to server
605605
globalToolNames.forEach((toolId) => {
606606
const tool = tools[toolId];
607+
if (!tool) {
608+
throw new Error(
609+
`Global tool ${toolId} not found in registry, available: ${Object.keys(
610+
tools
611+
).join(", ")}`
612+
);
613+
}
607614
this.tool(
608615
toolId,
609616
tool.description || "No description available",
610617
jsonSchema(tool.inputSchema as any),
611-
tool.execute,
618+
tool.execute
612619
);
613620
});
614621

@@ -646,11 +653,9 @@ export class ComposableMCPServer extends Server {
646653
}
647654
if (!tool) {
648655
throw new Error(
649-
`Action ${toolName} not found, available action list: ${
650-
allToolNames.join(
651-
", ",
652-
)
653-
}`,
656+
`Action ${toolName} not found, available action list: ${allToolNames.join(
657+
", "
658+
)}`
654659
);
655660
}
656661

@@ -659,10 +664,10 @@ export class ComposableMCPServer extends Server {
659664
(tool.inputSchema.jsonSchema as JSONSchema) ??
660665
// Standard definition
661666
tool.inputSchema ?? {
662-
type: "object",
663-
properties: {},
664-
required: [],
665-
};
667+
type: "object",
668+
properties: {},
669+
required: [],
670+
};
666671

667672
const baseProperties =
668673
baseSchema.type === "object" && baseSchema.properties

0 commit comments

Comments
 (0)