Home/Tools/@tpmjs/tools-csp-compose

cspComposeTool

@tpmjs/tools-csp-compose

Compose a Content Security Policy header from directive configurations

Official
security
v0.2.0
MIT

Interactive Playground

Test @tpmjs/tools-csp-compose (cspComposeTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-csp-compose
pnpm add @tpmjs/tools-csp-compose
yarn add @tpmjs/tools-csp-compose
bun add @tpmjs/tools-csp-compose
deno add npm:@tpmjs/tools-csp-compose

2. Import the tool

import { cspComposeTool } from '@tpmjs/tools-csp-compose';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { cspComposeTool } from '@tpmjs/tools-csp-compose';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { cspComposeTool },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Signature

(policies: Record<string, unknown>) => Promise<unknown>

Tags

compose
configurations
content
content-security-policy
csp
directive
header
policy
security
tpmjs

Parameters

Available configuration options

Auto-extracted
policies
Required
Type: object

CSP directives mapped to source arrays

Schema extracted: 3/1/2026, 4:29:11 AM

README

ERROR: No README data found!

Statistics

Downloads/month

60

GitHub Stars

0

Quality Score

79%

Bundle Size

NPM Keywords

tpmjs
security
csp
content-security-policy

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai
cspComposeTool | TPMJS | TPMJS