@tpmjs/tools-sitemap-read
Parse XML sitemaps and extract URLs from sitemap.xml files
Test @tpmjs/tools-sitemap-read (sitemapReadTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-sitemap-readpnpm add @tpmjs/tools-sitemap-readyarn add @tpmjs/tools-sitemap-readbun add @tpmjs/tools-sitemap-readdeno add npm:@tpmjs/tools-sitemap-readimport { sitemapReadTool } from '@tpmjs/tools-sitemap-read';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { sitemapReadTool } from '@tpmjs/tools-sitemap-read';
const result = await generateText({
model: openai('gpt-4o'),
tools: { sitemapReadTool },
prompt: 'Your prompt here...',
});
console.log(result.text);(url: string) => Promise<unknown>Available configuration options
urlstringThe sitemap.xml URL to parse
Schema extracted: 3/1/2026, 4:25:34 AM
Parse XML sitemaps and extract URLs from sitemap.xml files.
npm install @tpmjs/tools-sitemap-read
import { sitemapReadTool } from '@tpmjs/tools-sitemap-read'; import { generateText } from 'ai'; const result = await generateText({ model: yourModel, tools: { sitemapReadTool }, prompt: 'Get all URLs from https://example.com/sitemap.xml', });
url (string, required): The sitemap.xml URL to parse{ urls: Array<{ loc: string; lastmod?: string; changefreq?: string; priority?: string; }>; isSitemapIndex: boolean; urlCount: number; sitemapIndexUrls?: Array<{ loc: string; lastmod?: string; }>; metadata: { fetchedAt: string; sourceUrl: string; type: 'urlset' | 'sitemapindex'; }; }
Contains direct page URLs with optional metadata:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://example.com/page</loc> <lastmod>2024-01-01</lastmod> <changefreq>weekly</changefreq> <priority>0.8</priority> </url> </urlset>
Contains references to other sitemap files:
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc>https://example.com/sitemap1.xml</loc> <lastmod>2024-01-01</lastmod> </sitemap> </sitemapindex>
MIT
Downloads/month
13
GitHub Stars
0
Quality Score