Skip to content

MCP: add templated tool descriptions and tool name prefixing for HTTP/STDIO servers#63

Draft
nmaguiar wants to merge 3 commits intomasterfrom
codex/add-handlebars-template-flag-to-ojobmcp.yaml
Draft

MCP: add templated tool descriptions and tool name prefixing for HTTP/STDIO servers#63
nmaguiar wants to merge 3 commits intomasterfrom
codex/add-handlebars-template-flag-to-ojobmcp.yaml

Conversation

@nmaguiar
Copy link
Collaborator

@nmaguiar nmaguiar commented Mar 7, 2026

Motivation

  • Allow MCP servers to expose tools with a configurable external prefix while keeping internal fns/fnsMeta keys unchanged and to evaluate tool description fields as Handlebars templates using current job args.

Description

  • Added new arguments tplDesc and toolPrefix with defaults and checks in both HTTP and STDIO MCP jobs to enable templated descriptions and optional tool name prefixing.
  • Implemented helper functions _applyTemplateToDescriptions, _prefixToolName, _resolveToolName, and _toToolMeta to walk/transform metadata, prefix tool names for exposure, and resolve incoming prefixed names back to internal keys.
  • Updated tools/list responses to return prefixed metadata produced via _toToolMeta, and updated tools/call handling to resolve the incoming params.name to the internal function key before invoking args.fns (including updating thrown/error messages accordingly).
  • Adjusted STDIO MCP server to expose prefixed tool names in its fs mapping and pass prefixed metadata to ow.server.mcpStdio, while preserving internal args.fns mapping and existing error/result normalization logic.

Testing

  • No automated tests were run as part of this change.

Nuno Miguel Aguiar added 2 commits March 7, 2026 04:57
  - 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant