Home/Tools/@tpmjs/tools-jq

query

@tpmjs/tools-jq

Run a jq expression on JSON input. Supports filtering, mapping, and transforming JSON data.

Official
utilities
v0.1.0
MIT
⚠️

This tool is currently broken

Execution Failed
Runtime error with test parameters
jq error: jq: error: test/0 is not defined at <top-level>, line 1:
test
jq: 1 compile error

Last checked: 2/26/2026, 4:24:25 AM

Interactive Playground

Test @tpmjs/tools-jq (query) 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-jq
pnpm add @tpmjs/tools-jq
yarn add @tpmjs/tools-jq
bun add @tpmjs/tools-jq
deno add npm:@tpmjs/tools-jq

2. Import the tool

import { query } from '@tpmjs/tools-jq';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { query } from '@tpmjs/tools-jq';

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

console.log(result.text);

Signature

(json: string, filter: string, sortKeys?: boolean, nullInput?: boolean, rawOutput?: boolean) => Promise<unknown>

Tags

agent
data
expression
filter
filtering
input
jq
json
mapping
query
run
supports
tpmjs
transforming
utilities

Parameters

Available configuration options

Auto-extracted
json
Required
Type: string

JSON string to process.

filter
Required
Type: string

jq filter expression (e.g., ".foo", ".[] | select(.x > 1)").

rawOutput
Optional
Type: boolean

Output raw strings without JSON quotes (-r flag). Default false.

sortKeys
Optional
Type: boolean

Sort object keys (-S flag). Default false.

nullInput
Optional
Type: boolean

Use null as input instead of the json field (-n flag). Default false.

Schema extracted: 2/26/2026, 4:24:25 AM

README

@tpmjs/tools-jq

jq JSON processing tools for AI agents. Query, filter, and format JSON data using jq expressions.

Requirements

The jq binary must be available in the system PATH. The TPMJS executor Docker image includes it.

Tools

  • query — Run a jq expression on JSON input
  • format — Pretty-print JSON

Usage

import { query, format } from '@tpmjs/tools-jq';

Statistics

Downloads/month

91

GitHub Stars

15

Quality Score

87%

Bundle Size

NPM Keywords

tpmjs
jq
json
query
filter
agent

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai