Conversation
- Extracted common `$t` template handling into a single `_applyTemplate` helper. - Replaced duplicated `_applyTemplateToDescriptions` implementations with a unified call. - Updated job resolution to use the new helper for both full and description‑only templates. - Minor cleanup of variable names and comments. This refactor improves maintainability and reduces code duplication while preserving existing behavior.
There was a problem hiding this comment.
Pull request overview
This PR extends the MCP HTTP and STDIO server jobs to (1) optionally render tool/metadata descriptions as Handlebars templates using the current oJob args and (2) optionally expose tools under a configurable external name prefix while keeping internal fns/fnsMeta keys unchanged.
Changes:
- Added
tplDescandtoolPrefixargs (with defaults/checks) to both HTTP and STDIO MCP jobs. - Implemented metadata transformation helpers to template description fields and to prefix/resolve tool names on list/call paths.
- Updated package manifest version and included new
.githubartifacts in the opack file list/hash.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
oJobMCP.yaml |
Adds templated tool descriptions and tool name prefixing for MCP HTTP/STDIO servers; updates tools list/call behavior accordingly. |
.package.yaml |
Bumps package version and includes .github assets in packaged files and hashes. |
Comments suppressed due to low confidence (2)
oJobMCP.yaml:171
- In this error path you're throwing a string but later format/log the error using
e.message. Wheneis a string,e.messageis undefined, so the client will get an unhelpful message. Prefer throwing anError(or normalizing withString(e)in the catch) so logs and responses always contain the actual message.
} else {
throw "Function not found: " + _toolName
}
} catch(e) {
logErr(`Error executing tool '${params.name}': ${e.message}`)
_res = {
content: [{
type: "text",
text: `Error executing tool '${params.name}': ${e.message}`
}],
oJobMCP.yaml:334
- Same issue as above: this handler throws a string (
"Function not found: ...") but the catch block logs/returnse.message, which will be undefined for string exceptions. Throw anErroror useString(e)in the catch when building the log/response.
} else {
throw "Function not found: " + _toolName
}
} catch(e) {
logErr(`Error executing tool '${params.name}': ${e.message}`)
_res = {
content: [{
type: "text",
text: `Error executing tool '${params.name}': ${e.message}`
}],
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -420,7 +510,7 @@ jobs: | |||
| } | |||
| }) | |||
There was a problem hiding this comment.
Object.keys(args.fns).map(...) is used only for side effects (populating fs). Using map here is misleading and allocates an unused array; use forEach (or a for...of) instead to make the intent clear.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: nmaguiar <11761746+nmaguiar@users.noreply.github.com>
[WIP] Update templated tool descriptions for HTTP/STDIO servers
Motivation
fns/fnsMetakeys unchanged and to evaluate tooldescriptionfields as Handlebars templates using current job args.Description
tplDescandtoolPrefixwith defaults and checks in both HTTP and STDIO MCP jobs to enable templated descriptions and optional tool name prefixing._applyTemplateToDescriptions,_prefixToolName,_resolveToolName, and_toToolMetato walk/transform metadata, prefix tool names for exposure, and resolve incoming prefixed names back to internal keys.tools/listresponses to return prefixed metadata produced via_toToolMeta, and updatedtools/callhandling to resolve the incomingparams.nameto the internal function key before invokingargs.fns(including updating thrown/error messages accordingly).fsmapping and pass prefixed metadata toow.server.mcpStdio, while preserving internalargs.fnsmapping and existing error/result normalization logic.Testing