Building and customizing solutions using Microsoft 365 Copilot APIs and tools
Use the test environment to systematically verify that the agent is actually allowed and configured to call the MCP tools, and that the MCP endpoint and permissions match what worked in the local/ngrok setup.
- Verify the MCP platform endpoint for test
- Confirm the agent in the test environment is pointing to the correct MCP endpoint, not the production or mock endpoint.
- For Agent 365 SDK–based agents, ensure
MCP_PLATFORM_ENDPOINTis set correctly for the test environment:- Python/JavaScript: in
.env:MCP_PLATFORM_ENDPOINT=<test MCP endpoint> - .NET: in
launchSettings.jsonunderenvironmentVariables:"MCP_PLATFORM_ENDPOINT": "<test MCP endpoint>"
- Python/JavaScript: in
- If
MCP_PLATFORM_ENDPOINTis missing, the production endpoint is used by default, which can cause tool calls to go to the wrong place or fail silently.
- Confirm MCP servers and tools are configured for test
- Use the Agent 365 tooling commands against the test environment to ensure the MCP servers are actually configured:
a365 develop list-configured - If the list is empty or missing the expected servers, add them (example for Mail tools):
a365 develop add-mcp-servers mcp_MailTools - Make sure the same MCP servers/tools that work in local/ngrok are present and reachable in the test environment.
- Check permissions and service principal for test
- Tool calls that silently fail and fall back to AI-only responses are often permission-related.
- Follow the MCP troubleshooting guidance:
- Ensure the required service principal for tooling exists in the test tenant by running the one-time setup script (for the appropriate environment) as documented:
# Run the one-time setup script for the tools service principal # https://github.com/microsoft/Agent365-devTools/blob/main/scripts/cli/Auth/New-Agent365ToolsServicePrincipalProdPublic.ps1 - In the Azure portal, validate that the agent blueprint API permissions include all required MCP server permissions for the test environment.
- Ensure the required service principal for tooling exists in the test tenant by running the one-time setup script (for the appropriate environment) as documented:
- If permissions are missing, the agent may complete OAuth but still be blocked from invoking tools.
- Use observability to confirm whether the model is attempting tool calls
- Instrument the agent with observability as described in the Agent 365 observability guidance and configure the observability environment variables.
- Run the agent in the test environment and inspect the real-time traces:
- Check for:
- Agent invocation traces
- Tool execution details
- LLM inference calls
- Error information
- Check for:
- Specifically verify whether the model is:
- Emitting a tool call at all, or
- Emitting a tool call that fails (for example, permission or connectivity error).
- If no tool call appears in traces, adjust the agent’s instructions or tool configuration so the model is more likely to call the tool (or set tool usage to required, if supported in the configuration).
- Test tool invocations directly in Agents Playground
- Use Agents Playground against the test environment to isolate whether the issue is with the agent configuration or the hosting surface:
- Connect the agent to the test environment endpoint.
- Invoke the same scenario that should trigger the MCP tools.
- Observe:
- Whether a tool call is generated.
- Whether the tool call returns an error.
- The testing guide recommends focusing on “Test tool invocations” to validate MCP tools end-to-end in the target environment.
- Validate MCP server connectivity from test
- If the test environment uses a different network path than local/ngrok, confirm the MCP server URL is reachable from that environment:
- Verify the URL is correct and the server is running.
- Check network/firewall rules that might block outbound requests from the test host.
- If using a mock tooling server for early testing, ensure:
- The mock server is actually running and listening (for example,
http://localhost:5309). -
MCP_PLATFORM_ENDPOINTin the test configuration matches the mock server address.
- The mock server is actually running and listening (for example,
- Use the Agent 365 troubleshooting guide for MCP-specific issues
- For symptoms like:
- Tool call failures
- “MCP server not found”
- Permission denied errors
- Follow the documented sequence:
- Verify MCP servers are configured (
a365 develop list-configured). - Ensure the service principal is set up.
- Use mock servers for early validation if needed:
a365 develop start-mock-tooling-server # then set MCP_PLATFORM_ENDPOINT=http://localhost:5309 - Verify permissions in the admin center and in the agent blueprint.
- Verify MCP servers are configured (
- Confirm tool attachment and model/tool compatibility
- In the test environment configuration:
- Confirm the tools are actually attached to the agent definition used for test.
- Confirm the model used in test supports tool calling.
- If deterministic tool usage is required, configure tool calling to be required so the model cannot respond without invoking the tool.
- Before marketplace submission
- Once tool calls succeed in test:
- Use the observability “Validate for store publishing” guidance to ensure all required attributes and traces are present.
- Re-run end-to-end tests in Agents Playground to confirm there is no fallback to AI-only responses for scenarios that must use tools.
These steps align the test environment configuration (endpoint, MCP servers, permissions, and observability) with what works in local/ngrok and provide concrete checks to identify where the tool invocation is failing so the agent can be unblocked for marketplace submission.
References: