get_proudnet_page
Retrieve content from specific ProudNet documentation pages to access detailed information about the networking library's features and usage.
Instructions
Get content from a specific ProudNet documentation page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the documentation page (e.g., /guides/getting-started) |
Implementation Reference
- server.js:163-211 (handler)The 'getPage' method implements the core logic of the 'get_proudnet_page' tool. It constructs the URL based on the input path, fetches the page using axios, parses it with cheerio, extracts main content and code blocks, and returns formatted text content.async getPage(path) { try { let url; if (path.startsWith('http')) { url = path; } else { // Default to docs.proudnet.com if no domain is specified if (path.includes('guide.nettention.com') || path.includes('help.nettention.com')) { url = path.startsWith('/') ? `https:/${path}` : `https://${path}`; } else { url = `https://docs.proudnet.com${path.startsWith('/') ? path : '/' + path}`; } } const response = await axios.get(url); const $ = cheerio.load(response.data); // Remove script and style elements $('script, style').remove(); // Extract main content const content = $('.content, main, article, [role="main"]').first(); const text = content.length > 0 ? content.text().trim() : $('body').text().trim(); // Extract code examples const codeBlocks = []; $('pre code, .highlight').each((_, elem) => { codeBlocks.push($(elem).text().trim()); }); return { content: [ { type: 'text', text: `Content from ${url}:\n\n${text.substring(0, 3000)}${text.length > 3000 ? '...' : ''}${ codeBlocks.length > 0 ? '\n\nCode Examples:\n' + codeBlocks.slice(0, 3).join('\n---\n') : '' }`, }, ], }; } catch (error) { throw new Error(`Failed to get page: ${error.message}`); } }
- server.js:44-57 (registration)Registration of the 'get_proudnet_page' tool in the ListToolsRequestHandler response, including name, description, and input schema definition.{ name: 'get_proudnet_page', description: 'Get content from a specific ProudNet documentation page', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the documentation page (e.g., /guides/getting-started)', }, }, required: ['path'], }, },
- server.js:78-80 (registration)The switch case in CallToolRequestHandler that routes calls to 'get_proudnet_page' to the 'getPage' method.case 'get_proudnet_page': return await this.getPage(args.path);
- server.js:47-56 (schema)Input schema definition for the 'get_proudnet_page' tool, specifying the required 'path' parameter.inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the documentation page (e.g., /guides/getting-started)', }, }, required: ['path'], },