tpmjs/packages/tools/official/fetch-text
Ajax Davis 09fd0a5833 feat: add 55 new business tools and improve existing implementations
New tools added across multiple domains:
- Sales: lead-score, proposal-outline, objection-response
- Marketing: competitor-brief, campaign-brief, social-post-draft, email-subject-score, audience-persona, content-calendar-plan, pricing-page-copy
- HR: job-description-draft, interview-questions, performance-review-draft, onboarding-checklist, compensation-band, survey-analyze, org-chart-format, offer-letter-draft, exit-interview-summarize, policy-doc-format
- Legal: contract-clause-scan, nda-template-draft, tos-readability, risk-clause-highlight, invoice-terms-extract, gdpr-data-map, copyright-notice, trademark-check
- Finance: expense-categorize, invoice-data-extract, budget-variance, cash-flow-project, revenue-breakdown, ratio-analysis, tax-deduction-scan, reconciliation-match
- Customer Experience: feedback-themes, churn-risk-score, nps-analysis, ticket-categorize, response-template-suggest, health-score-calculate, renewal-forecast
- Education: lesson-plan-outline, quiz-generate, rubric-create, syllabus-format, progress-report-draft, learning-objective-write, curriculum-map

Also includes improvements to 68 existing tool implementations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-01 19:23:32 +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: version packages 2025-12-31 23:54:47 +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-fetch-text

Fetch a URL and return plain text content with metadata.

Installation

npm install @tpmjs/tools-fetch-text

Usage

import { fetchTextTool } from '@tpmjs/tools-fetch-text';

// Use with AI SDK
const result = await fetchTextTool.execute({
  url: 'https://example.com',
});

console.log(result.text); // Plain text content
console.log(result.contentType); // 'text/html; charset=utf-8'
console.log(result.contentLength); // 12345
console.log(result.metadata); // { fetchedAt, statusCode, redirected, finalUrl }

Features

  • Fetches any URL and returns plain text
  • Automatically strips HTML tags from HTML content
  • Decodes common HTML entities
  • 30 second timeout for requests
  • Returns metadata including content type, length, status code
  • Tracks redirects and provides final URL
  • Comprehensive error handling

Input

  • url (string, required): The URL to fetch (must be http or https)

Output

Returns a FetchTextResult object:

{
  text: string;           // Plain text content (HTML stripped if applicable)
  url: string;            // Original URL
  contentLength: number;  // Length of raw content in bytes
  contentType: string;    // Content-Type header value
  metadata: {
    fetchedAt: string;    // ISO timestamp of when content was fetched
    statusCode: number;   // HTTP status code
    redirected: boolean;  // Whether the request was redirected
    finalUrl: string;     // Final URL after redirects
  };
}

Requirements

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

License

MIT