Skip to content

Commit 470cce2

Browse files
committed
feat: update version to 0.1.5-beta.3; enhance logging plugin to ensure uniqueness of tool names in output
1 parent 9c00e9b commit 470cce2

23 files changed

+214
-150
lines changed

packages/core/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mcpc/core",
3-
"version": "0.1.5-beta.2",
3+
"version": "0.1.5-beta.3",
44
"tasks": {
55
"server:compile": "echo \"no need to compile\"",
66
"test": "deno test --allow-env --allow-read tests/",

packages/core/examples/04-dynamic-workflow-processor.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export const server = await mcpc(
3434
// No predefined steps - will generate dynamically at runtime
3535
},
3636

37-
description: `**Objective:** Process and analyze documents through a dynamically generated workflow that adapts to document type and processing requirements.
37+
description:
38+
`**Objective:** Process and analyze documents through a dynamically generated workflow that adapts to document type and processing requirements.
3839
3940
**Dynamic Workflow Generation:**
4041
I analyze each document processing request and dynamically create an optimal workflow with these potential phases:
@@ -165,18 +166,21 @@ The exact workflow steps will be generated dynamically based on the specific doc
165166
is_supported: isSupported,
166167
format_matches: formatMatch,
167168
supported_formats: supportedFormats,
168-
validation_result:
169-
isSupported && formatMatch ? "VALID" : "INVALID",
169+
validation_result: isSupported && formatMatch
170+
? "VALID"
171+
: "INVALID",
170172
recommendations: !isSupported
171-
? `Format '${extension}' is not supported. Supported formats: ${supportedFormats.join(
172-
", "
173-
)}`
173+
? `Format '${extension}' is not supported. Supported formats: ${
174+
supportedFormats.join(
175+
", ",
176+
)
177+
}`
174178
: !formatMatch
175179
? `Format mismatch: expected '${expected_format}', got '${extension}'`
176180
: "Document format is valid for processing",
177181
},
178182
null,
179-
2
183+
2,
180184
),
181185
},
182186
],
@@ -189,21 +193,22 @@ The exact workflow steps will be generated dynamically based on the specific doc
189193
text: JSON.stringify(
190194
{
191195
error: "Failed to validate document format",
192-
details:
193-
error instanceof Error ? error.message : "Unknown error",
196+
details: error instanceof Error
197+
? error.message
198+
: "Unknown error",
194199
file_path,
195200
},
196201
null,
197-
2
202+
2,
198203
),
199204
},
200205
],
201206
};
202207
}
203208
},
204-
{ internal: true } // This makes it an internal tool
209+
{ internal: true }, // This makes it an internal tool
205210
);
206-
}
211+
},
207212
);
208213

209214
const transport = new StdioServerTransport();

packages/core/examples/08-internal-tools-with-mcpc.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ except Exception as e:
120120
"code-runner.python-code-runner",
121121
{
122122
code: wrappedCode,
123-
}
123+
},
124124
);
125125

126126
return {
@@ -139,7 +139,7 @@ ${JSON.stringify(executionResult, null, 2)}`,
139139
],
140140
};
141141
},
142-
{ internal: true }
142+
{ internal: true },
143143
);
144144

145145
// Code safety validator
@@ -181,19 +181,19 @@ ${JSON.stringify(executionResult, null, 2)}`,
181181
isValid ? "✅ SAFE" : "❌ UNSAFE"
182182
}
183183
${
184-
issues.length > 0
185-
? "\nIssues:\n" + issues.map((i) => `- ${i}`).join("\n")
186-
: "No issues found."
187-
}`,
184+
issues.length > 0
185+
? "\nIssues:\n" + issues.map((i) => `- ${i}`).join("\n")
186+
: "No issues found."
187+
}`,
188188
},
189189
],
190190
};
191191
},
192-
{ internal: true }
192+
{ internal: true },
193193
);
194194

195195
console.log("✅ Internal tool wrappers registered!");
196-
}
196+
},
197197
);
198198

199199
const mcpTransport = new StdioServerTransport();

packages/core/examples/09-unified-prompt-management.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ const wildcardTools = availableTools
6767
.join("\n");
6868

6969
// Use the centralized template system with local description
70-
const fileOperationsDescription = `Advanced file management system with sophisticated tool management and security features.
70+
const fileOperationsDescription =
71+
`Advanced file management system with sophisticated tool management and security features.
7172
7273
**Public Tools with Enhanced Descriptions:**
7374
{publicTools}
@@ -175,7 +176,7 @@ export const server = await mcpc(
175176
],
176177
};
177178
},
178-
{ internal: true } // internal tool
179+
{ internal: true }, // internal tool
179180
);
180181

181182
server.tool(
@@ -197,18 +198,18 @@ export const server = await mcpc(
197198
}),
198199
(args) => {
199200
// Mock validation logic
200-
const isValid =
201-
!args.path.includes("/system") && !args.path.includes("/etc");
201+
const isValid = !args.path.includes("/system") &&
202+
!args.path.includes("/etc");
202203

203204
const message = isValid
204205
? CompiledPrompts.securityPassed({
205-
operation: args.operation,
206-
path: args.path,
207-
})
206+
operation: args.operation,
207+
path: args.path,
208+
})
208209
: CompiledPrompts.securityFailed({
209-
operation: args.operation,
210-
path: args.path,
211-
});
210+
operation: args.operation,
211+
path: args.path,
212+
});
212213

213214
return {
214215
content: [
@@ -219,14 +220,14 @@ export const server = await mcpc(
219220
],
220221
};
221222
},
222-
{ internal: true } // internal tool
223+
{ internal: true }, // internal tool
223224
);
224225

225226
console.log("✅ Unified prompt management system initialized!");
226227
console.log(
227-
"📝 All prompts are now centrally managed and dynamically generated"
228+
"📝 All prompts are now centrally managed and dynamically generated",
228229
);
229-
}
230+
},
230231
);
231232

232233
const transport = new StdioServerTransport();

packages/core/examples/10-ensure-actions-workflow-processor.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export const toolDefinitions: ComposeDefinition[] = [
2727
// No predefined steps - will generate dynamically at runtime
2828
},
2929

30-
description: `**Objective:** Process and analyze documents through a dynamically generated workflow that adapts to document type and processing requirements.
30+
description:
31+
`**Objective:** Process and analyze documents through a dynamically generated workflow that adapts to document type and processing requirements.
3132
3233
**Dynamic Workflow Generation:**
3334
I analyze each document processing request and dynamically create an optimal workflow with these potential phases:
@@ -168,18 +169,21 @@ export const server = await mcpc(
168169
is_supported: isSupported,
169170
format_matches: formatMatch,
170171
supported_formats: supportedFormats,
171-
validation_result:
172-
isSupported && formatMatch ? "VALID" : "INVALID",
172+
validation_result: isSupported && formatMatch
173+
? "VALID"
174+
: "INVALID",
173175
recommendations: !isSupported
174-
? `Format '${extension}' is not supported. Supported formats: ${supportedFormats.join(
175-
", "
176-
)}`
176+
? `Format '${extension}' is not supported. Supported formats: ${
177+
supportedFormats.join(
178+
", ",
179+
)
180+
}`
177181
: !formatMatch
178182
? `Format mismatch: expected '${expected_format}', got '${extension}'`
179183
: "Document format is valid for processing",
180184
},
181185
null,
182-
2
186+
2,
183187
),
184188
},
185189
],
@@ -192,21 +196,22 @@ export const server = await mcpc(
192196
text: JSON.stringify(
193197
{
194198
error: "Failed to validate document format",
195-
details:
196-
error instanceof Error ? error.message : "Unknown error",
199+
details: error instanceof Error
200+
? error.message
201+
: "Unknown error",
197202
file_path,
198203
},
199204
null,
200-
2
205+
2,
201206
),
202207
},
203208
],
204209
};
205210
}
206211
},
207-
{ internal: true } // This makes it an internal tool
212+
{ internal: true }, // This makes it an internal tool
208213
);
209-
}
214+
},
210215
);
211216

212217
const transport = new StdioServerTransport();

packages/core/examples/11-large-result-plugin-agentic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ const server = await mcpc(
4343
}
4444
return { content: [{ type: "text", text }] };
4545
},
46-
{ internal: true }
46+
{ internal: true },
4747
);
48-
}
48+
},
4949
);
5050

5151
const transport = new StdioServerTransport();

packages/core/examples/12-large-result-plugin-workflow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ const server = await mcpc(
4444
}
4545
return { content: [{ type: "text", text }] };
4646
},
47-
{ internal: true }
47+
{ internal: true },
4848
);
49-
}
49+
},
5050
);
5151

5252
const transport = new StdioServerTransport();

packages/core/src/compose.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,12 @@ import {
2727
// Import plugin types and utilities
2828
import type {
2929
ComposedTool,
30-
ToolPlugin,
30+
ComposeEndContext,
3131
ToolConfig,
32+
ToolPlugin,
3233
TransformContext,
33-
ComposeEndContext,
3434
} from "./plugin-types.ts";
35-
import {
36-
shouldApplyPlugin,
37-
loadPlugin,
38-
} from "./plugin-utils.ts";
35+
import { loadPlugin, shouldApplyPlugin } from "./plugin-utils.ts";
3936

4037
const ALL_TOOLS_PLACEHOLDER = "__ALL__";
4138

@@ -87,8 +84,8 @@ export class ComposableMCPServer extends Server {
8784
* Check if a tool exists in storage
8885
*/
8986
private hasToolInStorage(name: string): boolean {
90-
// Treat tool existence as presence in the runtime registry (external or internal)
91-
return this.toolRegistry.has(name);
87+
// Treat tool existence as presence in the runtime registry (external or internal)
88+
return this.toolRegistry.has(name);
9289
}
9390

9491
/**
@@ -345,13 +342,13 @@ export class ComposableMCPServer extends Server {
345342
if (plugin.configureServer) {
346343
await plugin.configureServer(this);
347344
}
348-
345+
349346
this.globalPlugins.push(plugin);
350347
}
351348

352349
/**
353350
* Load and register a plugin from a file path with optional parameters
354-
*
351+
*
355352
* Supports parameter passing via query string syntax:
356353
* loadPluginFromPath("path/to/plugin.ts?param1=value1&param2=value2")
357354
*/
@@ -397,7 +394,7 @@ export class ComposableMCPServer extends Server {
397394
}
398395
}
399396
}
400-
397+
401398
return currentTool;
402399
}
403400

@@ -421,7 +418,11 @@ export class ComposableMCPServer extends Server {
421418
execute: toolData.callback,
422419
};
423420

424-
const processedTool = await this.applyTransformToolHooks(tempTool, toolId, mode);
421+
const processedTool = await this.applyTransformToolHooks(
422+
tempTool,
423+
toolId,
424+
mode,
425+
);
425426

426427
this.toolRegistry.set(toolId, {
427428
callback: processedTool.execute,
@@ -442,11 +443,13 @@ export class ComposableMCPServer extends Server {
442443
/**
443444
* Trigger composeEnd hooks for all plugins
444445
*/
445-
private async triggerComposeEndHooks(context: ComposeEndContext): Promise<void> {
446-
const endPlugins = this.globalPlugins.filter(p =>
446+
private async triggerComposeEndHooks(
447+
context: ComposeEndContext,
448+
): Promise<void> {
449+
const endPlugins = this.globalPlugins.filter((p) =>
447450
p.composeEnd && shouldApplyPlugin(p, context.mode)
448451
);
449-
452+
450453
for (const plugin of endPlugins) {
451454
if (plugin.composeEnd) {
452455
await plugin.composeEnd(context);
@@ -570,13 +573,13 @@ export class ComposableMCPServer extends Server {
570573

571574
// For agentic interface: external tools (non-hidden) + internal tools
572575
const allToolNames = [...externalToolNames, ...internalToolNames];
573-
576+
574577
// Trigger composition complete hooks
575578
await this.triggerComposeEndHooks({
576579
serverName: name,
577580
externalToolNames,
578581
internalToolNames,
579-
pluginNames: this.globalPlugins.map(p => p.name),
582+
pluginNames: this.globalPlugins.map((p) => p.name),
580583
totalTools: allToolNames.length,
581584
mode: options.mode ?? "agentic",
582585
server: this,

packages/core/src/executors/agentic/agentic-tool-registrar.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ export function registerAgenticTool(
1919
sampling = false,
2020
}: RegisterToolParams,
2121
) {
22-
const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, undefined, undefined);
22+
const createArgsDef = createArgsDefFactory(
23+
name,
24+
allToolNames,
25+
depGroups,
26+
undefined,
27+
undefined,
28+
);
2329

2430
// Determine if sampling mode is enabled and extract config
2531
const isSamplingMode = sampling === true || typeof sampling === "object";

packages/core/src/factories/args-def-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function createArgsDefFactory(
2727
}
2828
return `\n\n## Required Actions
2929
The workflow MUST include at least one of these actions:
30-
${ensureStepActions.map(action => `- \`${action}\``).join('\n')}`;
30+
${ensureStepActions.map((action) => `- \`${action}\``).join("\n")}`;
3131
};
3232

3333
return {

0 commit comments

Comments
 (0)