Description
When chaining steps in composite tools, templates cannot access nested fields in backend tool outputs. This is because the HTTP backend client ignores StructuredContent.
Current Behavior
The backend HTTP client processes tool results here (pkg/vmcp/client/client.go#L474-L500):
for i, content := range result.Content {
if textContent, ok := mcp.AsTextContent(content); ok {
resultMap["text"] = textContent.Text
} else if imageContent, ok := mcp.AsImageContent(content); ok {
resultMap[key] = imageContent.Data
} else {
logger.Debugf("Unsupported content type...")
}
}
// result.StructuredContent ignored entirely.
If a backend tool returns:
{"message": "hello", "count": 42}
The step output becomes:
{"text": "{\"message\": \"hello\", \"count\": 42}"}
Expected Behavior
Based on the documentation, Templates like {{.steps.step1.output.message}} should work for accessing nested fields in tool results.
Impact
- Step chaining is limited: Can only access
.steps.stepID.output.text, not .steps.stepID.output.someField.someNestedField
Suggested Solution
The schema for step step.output in the composite step templating becomes:
{
structuredContent any
text string
// other text_i fields, etc. as the code currently performs above.
}
Alternatively, if structuredContent is present, then that simply is the output and the other content is ignored.
Regardless, we'll want to backfill testing to ensure references to structured data between tool steps is working as intended.
Related
Description
When chaining steps in composite tools, templates cannot access nested fields in backend tool outputs. This is because the HTTP backend client ignores StructuredContent.
Current Behavior
The backend HTTP client processes tool results here (
pkg/vmcp/client/client.go#L474-L500):If a backend tool returns:
{"message": "hello", "count": 42}The step output becomes:
{"text": "{\"message\": \"hello\", \"count\": 42}"}Expected Behavior
Based on the documentation, Templates like
{{.steps.step1.output.message}}should work for accessing nested fields in tool results.Impact
.steps.stepID.output.text, not.steps.stepID.output.someField.someNestedFieldSuggested Solution
The schema for step
step.outputin the composite step templating becomes:{ structuredContent any text string // other text_i fields, etc. as the code currently performs above. }Alternatively, if structuredContent is present, then that simply is the output and the other content is ignored.
Regardless, we'll want to backfill testing to ensure references to structured data between tool steps is working as intended.
Related
defaultResultsfor skipped/failed steps)