Mistral

Connect Integrations to
Mistral

Build advanced AI agents with Mistral. Connect 600+ integrations, automate workflows, and deploy with ease using Metorial.

Back to Mistral overview

Error Handling and Debugging

Learn how to handle errors and debug issues when using Metorial with the AI SDK.

Common Errors

Invalid API Key

try {
  const metorial = new Metorial({
    apiKey: 'invalid-key'
  });
  
  await metorial.withProviderSession(
    metorialAiSdk,
    { serverDeployments: ['deployment-id'] },
    async session => {
      // ...
    }
  );
} catch (error) {
  if (error.message.includes('Invalid API key')) {
    console.error('Please check your Metorial API key');
  }
}

Invalid Server Deployment

If you reference a deployment ID that doesn't exist:

try {
  await metorial.withProviderSession(
    metorialAiSdk,
    { serverDeployments: ['non-existent-deployment'] },
    async session => {
      // ...
    }
  );
} catch (error) {
  console.error('Deployment not found:', error.message);
}

Debugging Tool Calls

To see what tools are available in your session:

await metorial.withProviderSession(
  metorialAiSdk,
  { serverDeployments: ['your-deployment-id'] },
  async session => {
    console.log('Available tools:', session.tools.length);
    console.log('Tool names:', session.tools.map(t => t.name));
    
    // Your AI SDK code
  }
);

Logging AI SDK Responses

To debug the full conversation flow:

import { generateText } from 'ai';

const result = await generateText({
  model: openai('gpt-4'),
  tools: session.tools,
  prompt: 'Your prompt',
  onFinish: ({ response }) => {
    console.log('Full response:', JSON.stringify(response, null, 2));
  }
});

Environment Variables for Debugging

Set up environment variables for easier debugging:

# .env
METORIAL_API_KEY=your-key
METORIAL_DEPLOYMENT_ID=your-deployment-id
DEBUG=true
const metorial = new Metorial({
  apiKey: process.env.METORIAL_API_KEY
});

if (process.env.DEBUG === 'true') {
  console.log('Debug mode enabled');
}

Getting Help

If you encounter issues:

  1. Check your API key is valid
  2. Verify your server deployment ID exists
  3. Ensure your integrations are properly configured
  4. Review the Metorial documentation
  5. Contact Metorial support with error logs

Mistral on Metorial

Connect Mistral AI to over 600 integrations with Metorial's developer-friendly platform built on the Model Context Protocol. Our open-source SDKs for Python and TypeScript make it effortless to give your Mistral-powered agents access to productivity tools, databases, APIs, and services without writing complex integration code. Add capabilities like calendar management, email automation, CRM access, and data retrieval to your Mistral applications in just a couple of lines of code. Metorial handles all the integration complexity—authentication, API calls, error handling, and maintenance—so you can focus on creating intelligent agent behaviors and exceptional user experiences. Whether you're building conversational AI, document analysis tools, or workflow automation with Mistral's efficient and powerful language models, Metorial provides the infrastructure to connect your agents to real-world tools seamlessly. Our MCP-native approach ensures your integrations are standardized, maintainable, and easy to extend. Stop spending valuable engineering time on integration plumbing and start shipping AI features that matter to your users.

Connect anything. Anywhere.

Ready to build with Metorial?

Let's take your AI-powered applications to the next level, together.

About Metorial

Metorial provides developers with instant access to 600+ MCP servers for building AI agents that can interact with real-world tools and services. Built on MCP, Metorial simplifies agent tool integration by offering pre-configured connections to popular platforms like Google Drive, Slack, GitHub, Notion, and hundreds of other APIs. Our platform supports all major AI agent frameworks—including LangChain, AutoGen, CrewAI, and LangGraph—enabling developers to add tool calling capabilities to their agents in just a few lines of code. By eliminating the need for custom integration code, Metorial helps AI developers move from prototype to production faster while maintaining security and reliability. Whether you're building autonomous research agents, customer service bots, or workflow automation tools, Metorial's MCP server library provides the integrations you need to connect your agents to the real world.

Star us on GitHub