tpmjs/packages/tools/official/sitemap-read
Ajax Davis 5c9f1a1d0a chore: update dependencies with compatibility fixes
- Update all packages to latest versions via pnpm update --latest
- Downgrade Prisma 7 to 6 (v7 requires schema migration)
- Downgrade Tailwind CSS 4 to 3 (v4 requires PostCSS migration)
- Downgrade Storybook 10 to 8 (addons not available in v10)
- Pin cheerio to 1.0.0-rc.12 via pnpm override (type exports changed)
- Fix AI SDK tool definitions: parameters -> inputSchema
- Fix cheerio types in extract-meta and table-extract tools
- Add explicit type annotations to tool execute functions
- Migrate biome config to v2.3.11 schema

All type-checks, tests, and builds pass.
2026-01-09 22:49:41 +10:00
..
src feat: add 55 new business tools and improve existing implementations 2026-01-01 19:23:32 +10:00
CHANGELOG.md chore: version packages 2025-12-31 23:54:47 +10:00
package.json chore: update dependencies with compatibility fixes 2026-01-09 22:49:41 +10:00
README.md feat: add 100+ official TPMJS tools 2025-12-31 22:55:56 +10:00
tsconfig.json feat: add 100+ official TPMJS tools 2025-12-31 22:55:56 +10:00
tsup.config.ts feat: add 100+ official TPMJS tools 2025-12-31 22:55:56 +10:00

@tpmjs/tools-sitemap-read

Parse XML sitemaps and extract URLs from sitemap.xml files.

Installation

npm install @tpmjs/tools-sitemap-read

Usage

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',
});

Tool Parameters

  • url (string, required): The sitemap.xml URL to parse

Returns

{
  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';
  };
}

Features

  • Supports both regular sitemaps (urlset) and sitemap indexes (sitemapindex)
  • Extracts URL locations with optional metadata (lastmod, changefreq, priority)
  • Handles sitemap index files that reference other sitemaps
  • Comprehensive error handling
  • 30-second timeout protection
  • Validates XML structure

Sitemap Types

Regular Sitemap (urlset)

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>

Sitemap Index (sitemapindex)

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>

Requirements

  • Node.js 18+ (uses native fetch API)

License

MIT