solve-problem
Resolve PaymanAI integration issues by describing your problem and specifying the SDK (nodejs or python) for targeted assistance.
Instructions
Get help with common PaymanAI integration issues
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| problem | Yes | Describe the issue you're experiencing | |
| sdk | No | Which SDK you're using (nodejs or python) |
Implementation Reference
- src/index.ts:408-512 (handler)The handler function implements the core logic for 'solve-problem': logs input, defines problem categories with keywords/topics, matches input to categories, generates SDK-specific advice, general troubleshooting steps, and lists relevant documentation topics to consult.
async ({ problem, sdk }) => { log(`Solving problem: "${problem}" for SDK: ${sdk || "any"}`); const problemCategories = [ { category: "Authentication", keywords: [ "api key", "auth", "authentication", "unauthorized", "401", ], topics: ["api-keys", "error-handling"], }, { category: "Payments", keywords: [ "payment", "send payment", "transaction", "failed payment", ], topics: ["send-payments", "error-handling"], }, { category: "Payees", keywords: ["payee", "recipient", "create payee", "add payee"], topics: ["create-payee", "create-payees"], }, { category: "Setup", keywords: [ "install", "setup", "configuration", "sdk", "initialize", ], topics: ["setup-and-installation", "quickstart"], }, { category: "Error Handling", keywords: ["error", "exception", "crash", "failed"], topics: ["error-handling", "api-reference"], }, ]; const problemLower = problem.toLowerCase(); const matchingCategories = problemCategories.filter((cat) => cat.keywords.some((keyword) => problemLower.includes(keyword)) ); const topicsToConsult = matchingCategories.length > 0 ? matchingCategories.flatMap((cat) => cat.topics) : ["error-handling", "api-reference", "quickstart"]; const uniqueTopics = [...new Set(topicsToConsult)]; let solutionText = `# Solution for: "${problem}"\n\n`; if (matchingCategories.length > 0) { solutionText += `This appears to be a ${matchingCategories .map((c) => c.category) .join("/")} related issue.\n\n`; } if (sdk) { solutionText += `## ${sdk.toUpperCase()} SDK Specific Guidance\n\n`; solutionText += `When working with the ${sdk} SDK, make sure to:\n\n`; if (sdk === "nodejs") { solutionText += `- Check you're using the latest version: \`npm view @paymanai/sdk version\`\n`; solutionText += `- Update if needed: \`npm install @paymanai/sdk@latest\`\n`; solutionText += `- Verify your environment variables are set correctly\n`; solutionText += `- Use try/catch blocks to properly handle API errors\n\n`; } else { solutionText += `- Check you're using the latest version: \`pip show paymanai\`\n`; solutionText += `- Update if needed: \`pip install --upgrade paymanai\`\n`; solutionText += `- Handle exceptions properly with try/except blocks\n`; solutionText += `- Ensure your Python version is compatible (3.7+)\n\n`; } } solutionText += `## Troubleshooting Steps\n\n`; solutionText += `1. **Check your API credentials** - Verify your API key is valid and correctly formatted\n`; solutionText += `2. **Look for specific error codes** - Error codes provide detailed information about what went wrong\n`; solutionText += `3. **Check your request format** - Ensure all required parameters are included and properly formatted\n`; solutionText += `4. **Review rate limits** - Make sure you're not exceeding API rate limits\n\n`; solutionText += `## Relevant Documentation\n\n`; uniqueTopics.forEach((topic) => { solutionText += `- ${topicMetadata[topic].title}: use get-documentation with topic "${topic}"\n`; }); return { content: [ { type: "text", text: solutionText, }, ], }; } - src/index.ts:401-407 (schema)Zod schema defining inputs for 'solve-problem' tool: required 'problem' string and optional 'sdk' enum.
{ problem: z.string().describe("Describe the issue you're experiencing"), sdk: z .enum(["nodejs", "python"]) .optional() .describe("Which SDK you're using (nodejs or python)"), }, - src/index.ts:398-513 (registration)Registers the 'solve-problem' tool on the MCP server with name, description, input schema, and handler function.
server.tool( "solve-problem", "Get help with common PaymanAI integration issues", { problem: z.string().describe("Describe the issue you're experiencing"), sdk: z .enum(["nodejs", "python"]) .optional() .describe("Which SDK you're using (nodejs or python)"), }, async ({ problem, sdk }) => { log(`Solving problem: "${problem}" for SDK: ${sdk || "any"}`); const problemCategories = [ { category: "Authentication", keywords: [ "api key", "auth", "authentication", "unauthorized", "401", ], topics: ["api-keys", "error-handling"], }, { category: "Payments", keywords: [ "payment", "send payment", "transaction", "failed payment", ], topics: ["send-payments", "error-handling"], }, { category: "Payees", keywords: ["payee", "recipient", "create payee", "add payee"], topics: ["create-payee", "create-payees"], }, { category: "Setup", keywords: [ "install", "setup", "configuration", "sdk", "initialize", ], topics: ["setup-and-installation", "quickstart"], }, { category: "Error Handling", keywords: ["error", "exception", "crash", "failed"], topics: ["error-handling", "api-reference"], }, ]; const problemLower = problem.toLowerCase(); const matchingCategories = problemCategories.filter((cat) => cat.keywords.some((keyword) => problemLower.includes(keyword)) ); const topicsToConsult = matchingCategories.length > 0 ? matchingCategories.flatMap((cat) => cat.topics) : ["error-handling", "api-reference", "quickstart"]; const uniqueTopics = [...new Set(topicsToConsult)]; let solutionText = `# Solution for: "${problem}"\n\n`; if (matchingCategories.length > 0) { solutionText += `This appears to be a ${matchingCategories .map((c) => c.category) .join("/")} related issue.\n\n`; } if (sdk) { solutionText += `## ${sdk.toUpperCase()} SDK Specific Guidance\n\n`; solutionText += `When working with the ${sdk} SDK, make sure to:\n\n`; if (sdk === "nodejs") { solutionText += `- Check you're using the latest version: \`npm view @paymanai/sdk version\`\n`; solutionText += `- Update if needed: \`npm install @paymanai/sdk@latest\`\n`; solutionText += `- Verify your environment variables are set correctly\n`; solutionText += `- Use try/catch blocks to properly handle API errors\n\n`; } else { solutionText += `- Check you're using the latest version: \`pip show paymanai\`\n`; solutionText += `- Update if needed: \`pip install --upgrade paymanai\`\n`; solutionText += `- Handle exceptions properly with try/except blocks\n`; solutionText += `- Ensure your Python version is compatible (3.7+)\n\n`; } } solutionText += `## Troubleshooting Steps\n\n`; solutionText += `1. **Check your API credentials** - Verify your API key is valid and correctly formatted\n`; solutionText += `2. **Look for specific error codes** - Error codes provide detailed information about what went wrong\n`; solutionText += `3. **Check your request format** - Ensure all required parameters are included and properly formatted\n`; solutionText += `4. **Review rate limits** - Make sure you're not exceeding API rate limits\n\n`; solutionText += `## Relevant Documentation\n\n`; uniqueTopics.forEach((topic) => { solutionText += `- ${topicMetadata[topic].title}: use get-documentation with topic "${topic}"\n`; }); return { content: [ { type: "text", text: solutionText, }, ], }; } );