get-sdk-help
Resolve Node.js or Python SDK queries by specifying the SDK and feature needing assistance. Enhances integration development with targeted support from Payman AI Documentation.
Instructions
Get help with Node.js or Python SDK usage
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| feature | Yes | Which SDK feature or class you need help with | |
| sdk | Yes | Which SDK you need help with |
Implementation Reference
- src/index.ts:526-627 (handler)Handler function that implements the logic for the 'get-sdk-help' tool. It searches SDK documentation topics for matches to the specified SDK and feature, extracts relevant sections, ranks by relevance, and returns formatted markdown help text with additional resources.async ({ sdk, feature }) => { log(`Getting help for ${sdk} SDK feature: ${feature}`); const sdkTopics = [ "setup-and-installation", "create-payees", "send-payments", "create-payee", "search-payees", "check-balances", ]; const helpPromises = sdkTopics.map(async (topic) => { const content = await fetchDocMarkdown(pathMap[topic]); const sdkIdentifier = sdk === "nodejs" ? ["node", "nodejs", "javascript", "js"] : ["python", "py"]; const relevance = sdkIdentifier.some( (id) => content.toLowerCase().includes(id) && content.toLowerCase().includes(feature.toLowerCase()) && Math.abs( content.toLowerCase().indexOf(id) - content.toLowerCase().indexOf(feature.toLowerCase()) ) < 500 ); if (!relevance) return null; const lines = content.split("\n"); const featureIndex = lines.findIndex((line) => line.toLowerCase().includes(feature.toLowerCase()) ); if (featureIndex === -1) return null; let headingIndex = featureIndex; while (headingIndex > 0 && !lines[headingIndex].startsWith("#")) { headingIndex--; } const sectionHeading = lines[headingIndex]; const sectionContent = lines .slice(headingIndex, featureIndex + 20) .join("\n"); return { topic, heading: sectionHeading, content: sectionContent, relevance: (content.toLowerCase().includes(sdk) ? 2 : 1) + (sectionContent .toLowerCase() .includes(feature.toLowerCase()) ? 3 : 0), }; }); const helpResults = (await Promise.all(helpPromises)).filter(Boolean); helpResults.sort((a, b) => (b?.relevance || 0) - (a?.relevance || 0)); if (helpResults.length === 0) { return { content: [ { type: "text", text: `No specific help found for ${feature} in the ${sdk} SDK. Try checking the full SDK documentation with get-documentation or using more generic terms.`, }, ], }; } let helpText = `# ${sdk.toUpperCase()} SDK Help: ${feature}\n\n`; helpResults.forEach((result) => { if (!result) return; helpText += `## From ${topicMetadata[result.topic].title}\n\n`; helpText += `${result.content}\n\n`; helpText += `*For complete documentation, use get-documentation with topic "${result.topic}"*\n\n---\n\n`; }); helpText += `## Additional Resources\n\n`; helpText += `- Setup and Installation: use get-documentation with topic "setup-and-installation"\n`; helpText += `- Error Handling: use get-documentation with topic "error-handling"\n`; helpText += `- For code examples, try the get-code-examples tool with feature="${feature}" and language="${sdk}"\n`; return { content: [ { type: "text", text: helpText, }, ], }; } );
- src/index.ts:518-525 (schema)Zod input schema defining the parameters for the 'get-sdk-help' tool: 'sdk' as an enum of 'nodejs' or 'python', and 'feature' as a string describing the SDK feature or class.{ sdk: z .enum(["nodejs", "python"]) .describe("Which SDK you need help with"), feature: z .string() .describe("Which SDK feature or class you need help with"), },
- src/index.ts:515-628 (registration)Registration of the 'get-sdk-help' tool on the MCP server using server.tool(), specifying the tool name, description, input schema, and handler function.server.tool( "get-sdk-help", "Get help with Node.js or Python SDK usage", { sdk: z .enum(["nodejs", "python"]) .describe("Which SDK you need help with"), feature: z .string() .describe("Which SDK feature or class you need help with"), }, async ({ sdk, feature }) => { log(`Getting help for ${sdk} SDK feature: ${feature}`); const sdkTopics = [ "setup-and-installation", "create-payees", "send-payments", "create-payee", "search-payees", "check-balances", ]; const helpPromises = sdkTopics.map(async (topic) => { const content = await fetchDocMarkdown(pathMap[topic]); const sdkIdentifier = sdk === "nodejs" ? ["node", "nodejs", "javascript", "js"] : ["python", "py"]; const relevance = sdkIdentifier.some( (id) => content.toLowerCase().includes(id) && content.toLowerCase().includes(feature.toLowerCase()) && Math.abs( content.toLowerCase().indexOf(id) - content.toLowerCase().indexOf(feature.toLowerCase()) ) < 500 ); if (!relevance) return null; const lines = content.split("\n"); const featureIndex = lines.findIndex((line) => line.toLowerCase().includes(feature.toLowerCase()) ); if (featureIndex === -1) return null; let headingIndex = featureIndex; while (headingIndex > 0 && !lines[headingIndex].startsWith("#")) { headingIndex--; } const sectionHeading = lines[headingIndex]; const sectionContent = lines .slice(headingIndex, featureIndex + 20) .join("\n"); return { topic, heading: sectionHeading, content: sectionContent, relevance: (content.toLowerCase().includes(sdk) ? 2 : 1) + (sectionContent .toLowerCase() .includes(feature.toLowerCase()) ? 3 : 0), }; }); const helpResults = (await Promise.all(helpPromises)).filter(Boolean); helpResults.sort((a, b) => (b?.relevance || 0) - (a?.relevance || 0)); if (helpResults.length === 0) { return { content: [ { type: "text", text: `No specific help found for ${feature} in the ${sdk} SDK. Try checking the full SDK documentation with get-documentation or using more generic terms.`, }, ], }; } let helpText = `# ${sdk.toUpperCase()} SDK Help: ${feature}\n\n`; helpResults.forEach((result) => { if (!result) return; helpText += `## From ${topicMetadata[result.topic].title}\n\n`; helpText += `${result.content}\n\n`; helpText += `*For complete documentation, use get-documentation with topic "${result.topic}"*\n\n---\n\n`; }); helpText += `## Additional Resources\n\n`; helpText += `- Setup and Installation: use get-documentation with topic "setup-and-installation"\n`; helpText += `- Error Handling: use get-documentation with topic "error-handling"\n`; helpText += `- For code examples, try the get-code-examples tool with feature="${feature}" and language="${sdk}"\n`; return { content: [ { type: "text", text: helpText, }, ], }; } );