Skip to content

Composite tools: elicitation message doesn't expand template expressions #4312

@danbarr

Description

@danbarr

Bug

Template expressions in elicitation step message fields (e.g. {{.params.owner}}) are not expanded — the raw placeholders are passed through to the client.

Example

- id: approval
  type: elicitation
  message: >
    PR #{{.params.pullNumber}} context gathered. Create a pending
    review on {{.params.owner}}/{{.params.repo}}?

Displays the literal {{.params.pullNumber}} instead of the resolved value.

Root cause

In pkg/vmcp/composer/workflow_engine.go, tool step arguments are explicitly expanded via templateExpander.Expand() (~line 404), but executeElicitationStep() (~line 639) passes step.Elicitation directly to RequestElicitation() without any template expansion.

The elicitation handler in pkg/vmcp/composer/elicitation_handler.go (~line 168) then passes the raw config.Message straight into the MCP elicitation request.

Suggested fix

Expand step.Elicitation.Message through the template expander before passing it to RequestElicitation() in executeElicitationStep(). Something like:

expandedMessage, err := e.templateExpander.Expand(ctx, step.Elicitation.Message, workflowCtx)
if err != nil {
    return fmt.Errorf("failed to expand elicitation message: %w", err)
}
step.Elicitation.Message = expandedMessage.(string)

Related

Documentation gaps for composite tools tracked in stacklok/docs-website#627.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggoPull requests that update go codevmcpVirtual MCP Server related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions