web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Copilot Studio - Model Context Protocol
Unanswered

Capture MCP Tool output in variable for chart response - dynamically fill with AI issue

(1) ShareShare
ReportReport
Posted on by 2
I have an agent with custom MCP tool. The MCP tool generates a chart and responds with the base64 encoded version. I'm trying to send this image (utilizing an adaptive card with Image type), via Teams channel, as a response to a user's question to my agent.
 
User question to agent -> agent invokes Create Chart MCP tool -> agent invokes tool flow passing in response from Create Chart MCP tool -> tool flow responds with adaptive card with chart image
 
It's my understanding that you can't (yet?) call an MCP tool from a flow tool action (or topic) and capture the output of the MCP tool directly (it's not available as an environment/context variable?). To work around that I'm creating a tool flow that takes 1 input (base64code) that is filled using 'Dynamically fill with AI' and basically does nothing with it other than setting a variable base64codefromflow. It basically acts as a passthrough. Then in the flow tool completion, I set the adaptive card as such.
 
{
type: "Image",
url: "data:image/png;base64,{Topic.Output.base64codefromflow}",
size: "stretch",
altText: "generated graph"
}
 
The problem I'm having is with the input to my flow. The input variable gets set 'Dynamically fill with AI' but instead of getting the exact output from the previous step, I get a slightly manipulated base64code, rendering it useless, even when I provide an agent instruction to pass it on exactly as received. 
 
1) Is there a better way to return an image to a question in a Teams channel when I have the base64 code provided by an MCP tool.
2) Is there another way to get the output of an MCP tool into a variable to use in a flow or in an adaptive card?
3) Is there a specific instruction I can use to ensure 'Dynamically fill with AI' does not alter the input to the flow when setting the input variable.
 
I could probably expose my chart generation service as a regular http endpoint connection which would allow me to use it as an action in a topic/flow and capture the output in a variable, but I'm trying to stick with the MCP tool approach.
 
Any suggestions/input are welcome. Thanks
 
 
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Copilot Studio

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 304 Super User 2025 Season 2

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 224 Super User 2025 Season 2

#3
Sam_Fawzi Profile Picture

Sam_Fawzi 78 Super User 2025 Season 2

Last 30 days Overall leaderboard