tanstack_list_libraries
List all TanStack libraries with descriptions, supported frameworks, and links. Filter by group: state, headlessUI, performance, or tooling.
Instructions
List all TanStack libraries with their descriptions, supported frameworks, and links
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group | No | Filter by library group |
Implementation Reference
- src/index.ts:193-210 (registration)Registration of the 'tanstack_list_libraries' tool via server.tool() with its schema and handler inline.
// 4. tanstack_list_libraries server.tool( "tanstack_list_libraries", "List all TanStack libraries with their descriptions, supported frameworks, and links", { group: z .enum(["state", "headlessUI", "performance", "tooling"]) .optional() .describe("Filter by library group"), }, async ({ group }) => { const args = ["libraries", "--json"]; if (group) args.push("--group", group); const { stdout } = await runCli(args); return jsonResult(parseJsonOutput(stdout)); }, ); - src/index.ts:197-202 (schema)Input schema definition for 'tanstack_list_libraries': optional 'group' enum filter (state, headlessUI, performance, tooling).
{ group: z .enum(["state", "headlessUI", "performance", "tooling"]) .optional() .describe("Filter by library group"), }, - src/index.ts:203-209 (handler)Handler function for 'tanstack_list_libraries'. Runs CLI with args ['libraries', '--json'] (plus optional '--group'), parses JSON output, and returns result.
async ({ group }) => { const args = ["libraries", "--json"]; if (group) args.push("--group", group); const { stdout } = await runCli(args); return jsonResult(parseJsonOutput(stdout)); }, - src/index.ts:34-41 (helper)Helper function parseJsonOutput() used to extract JSON from CLI output that may contain text warnings before the JSON blob.
function parseJsonOutput(stdout: string): unknown { // The CLI may print warnings before the JSON blob – find the first { or [ const jsonStart = stdout.search(/[\[{]/); if (jsonStart === -1) { throw new Error(`CLI returned non-JSON output:\n${stdout}`); } return JSON.parse(stdout.slice(jsonStart)); } - src/index.ts:18-32 (helper)Helper function runCli() that executes the TanStack CLI via npx @tanstack/cli with specified args, used by the handler to invoke 'libraries --json'.
async function runCli( args: string[], timeoutMs = 60_000, ): Promise<{ stdout: string; stderr: string }> { const { stdout, stderr } = await execFileAsync( TANSTACK_CLI, [...TANSTACK_ARGS, ...args], { timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024, // 10 MB env: { ...process.env, NO_COLOR: "1" }, }, ); return { stdout: stdout.trim(), stderr: stderr.trim() }; }