Building and customizing solutions using Microsoft 365 Copilot APIs and tools
Custom MCP Federated Connector returns expired above certain response size
I'm building on a custom federated connector. I setup the connector successfully, everything works from an authentication / tool discovery standpoint on CoPilot chat.
Doing a small tool call works fine, but at a certain size, CoPilot says that Expired is returned. I can't get the exact size of failure but I estimate it to be around 50 KB.
I could consistently reproduce the bug by getting timeseries data from one of my tools, and progressively increasing the date range until it failed (see attached screenshots), but any tool where you can vary the response size based on inputs should be able to reproduce the problem.
There's a few bugs here
- The error message is wrong since the tool call isn't actually expired, the problem stems from response size. This also has the side effect of confusing copilot since it believes there's an expired connection.
- The response size which causes a failure is quite small which significantly limits the usefulness of our custom federated connector. ChatGPT and Claude can handle response sizes much larger than this without problem.
Interestingly, researcher mode in copilot chat can also handle response sizes that caused this error regular copilot chat mode, but because of how long it takes researcher to respond, it isn't really practical for our use case.