Implements a comprehensive suite of AI SDK v6 tools across multiple categories: - Research (5): page-brief, compare-pages, source-credibility, claim-checklist, timeline-from-text - Web (10): fetch-text, links-catalog, extract-meta, extract-json-ld, redirect-trace, sitemap-read, rss-read, table-extract, robots-policy, url-normalize - Data (15): csv-parse, csv-stringify, json-repair, json-schema-validate, yaml-parse, yaml-stringify, text-chunk, normalize-whitespace, dedupe-by-key, pivot, rows-filter, rows-sort, rows-group-aggregate, rows-join, schema-infer - Doc (12): toc-generate, glossary-build, faq-from-text, executive-brief, decision-record-adr, prd-outline, acceptance-criteria, style-rewrite - Eng (12): diff-text-unified, env-var-docs-generate, dependency-audit-lite, conventional-commit-suggest, markdown-lint-basic, test-case-generate, stacktrace-parse, release-notes, changelog-entry, release-checklist - Security (7): redact-secrets, secret-scan-text, url-risk-heuristic, csp-compose, hardening-checklist-web, access-control-matrix, data-classification-heuristic - Stats (9): effect-size-suite, bootstrap-ci, permutation-test, multiple-testing-adjust, linear-regression-ols, logistic-regression, time-series-decompose-lite, anomaly-detect-mad - Ops (7): slo-draft, runbook-draft, postmortem-draft, postmortem-action-extractor, error-log-triage, coverage-tracker, monitoring-gap-analysis - Agent (15): prompt-to-workflow-skeleton, workflow-validate-io, workflow-explain, workflow-cost-estimate, tool-call-accuracy-score, eval-fixture-build, guardrail-policy-draft, workflow-auto-repair, tool-selection-plan, novelty-score-workflow, workflow-variant-generate, config-normalize, recipe-* - Utility (8): base64-encode, base64-decode, hash-text, regex-extract, template-render, date-parse, json-path-query, url-parse - HTML (3): html-sanitize, html-to-markdown, markdown-to-html All tools follow AI SDK v6 pattern with tool() and jsonSchema<T>(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsup.config.ts | ||
@tpmjs/tools-yaml-parse
Parse YAML text into JavaScript objects with validation and error handling.
Installation
npm install @tpmjs/tools-yaml-parse
Usage
import { yamlParseTool } from '@tpmjs/tools-yaml-parse';
// Use with AI SDK
const result = await yamlParseTool.execute({
yaml: `
name: John Doe
age: 30
hobbies:
- reading
- coding
- hiking
`
});
console.log(result);
// {
// data: { name: 'John Doe', age: 30, hobbies: ['reading', 'coding', 'hiking'] },
// isValid: true,
// metadata: { type: 'object', size: 3 }
// }
Features
- Validation: Returns both parsed data and validation status
- Error Handling: Graceful error messages for invalid YAML
- Metadata: Provides type information and size of parsed data
- Standards Compliant: Uses
js-yamllibrary for full YAML 1.2 support
Input Schema
| Parameter | Type | Required | Description |
|---|---|---|---|
| yaml | string | Yes | The YAML string to parse |
Output Schema
interface YamlParseResult {
data: unknown; // The parsed JavaScript object/value
isValid: boolean; // Whether parsing was successful
error?: string; // Error message if parsing failed
metadata?: {
type: string; // Type of parsed data (object, array, string, etc.)
size: number; // Number of keys (objects) or items (arrays)
};
}
Examples
Parse YAML Object
const result = await yamlParseTool.execute({
yaml: 'name: Alice\nage: 25'
});
// { data: { name: 'Alice', age: 25 }, isValid: true, ... }
Parse YAML Array
const result = await yamlParseTool.execute({
yaml: '- apple\n- banana\n- cherry'
});
// { data: ['apple', 'banana', 'cherry'], isValid: true, metadata: { type: 'array', size: 3 } }
Handle Invalid YAML
const result = await yamlParseTool.execute({
yaml: 'invalid: yaml: syntax:'
});
// { data: null, isValid: false, error: 'bad indentation...' }
License
MIT