docs
Run JavaScript to fetch, search, and index official documentation for multiple frameworks like Next.js, React, and Supabase. Retrieve specific pages or ranked matches across stacks.
Instructions
Run JavaScript in a local Node sandbox. Write ONE async arrow function that returns a value.
Inside the sandbox you have:
codemode.(args) — calls an MCP tool over the wire. Each codemode.* method below is a real callable.
fetch, Promise, JSON, standard async — Node 18+ globals.
30s async timeout (sync infinite loops are not bounded). One call, one result; no streaming.
Fan out independent calls with Promise.all — that is why this tool exists. N tool calls collapse into one MCP round-trip.
Available tools:
type NextjsDocsInput = {
/** Documentation path (e.g., '/docs/app/api-reference/functions/refresh'). Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling codemode.nextjs_index() first. App Router only — Pages Router paths ('/docs/pages/...') are not supported. /
path: string;
/* Optional anchor/section from the index (e.g., 'usage'). Included in response metadata to indicate relevant section. /
anchor?: string;
};
type NextjsDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type ReactDocsInput = {
/* Documentation path (e.g., '/learn/react-compiler.md' or '/reference/react/useState.md'). The path includes the .md suffix as listed in the index. Get valid paths by calling codemode.react_index() first. /
path: string;
};
type ReactDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type TurborepoDocsInput = {
/* Documentation path (e.g., '/guides/tools/docker.md', '/reference/run.md', or 'index.md'). Paths are relative to '/docs/'; the tool resolves them under turborepo.dev/docs/. Get valid paths by calling codemode.turborepo_index() first. /
path: string;
};
type TurborepoDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type SupabaseDocsInput = {
/* Guide path (e.g., '/docs/guides/functions/auth'). Must start with '/docs/guides/'. Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling codemode.supabase_index() first. /
path: string;
};
type SupabaseDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type EffectDocsInput = {
/* Documentation path (e.g., '/docs/batching/' or '/docs/schema/introduction/'). Paths are pathnames from effect.website with the trailing slash, exactly as listed in the index. Get valid paths by calling codemode.effect_index() first. /
path: string;
};
type EffectDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type OxcDocsInput = {
/* Documentation path from the index (e.g., '/docs/guide/usage/linter/automatic-fixes.md'). Paths already include the '.md' suffix as listed in the index. Get valid paths by calling codemode.oxc_index() first. /
path: string;
};
type OxcDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type TanstackStartDocsInput = {
/* Documentation path from the index (e.g., '/start/latest/docs/framework/react/overview'). Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling the matching codemode.tanstack_index() first. /
path: string;
};
type TanstackStartDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type TanstackRouterDocsInput = {
/* Documentation path from the index (e.g., '/start/latest/docs/framework/react/overview'). Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling the matching codemode.tanstackindex() first. /
path: string;
};
type TanstackRouterDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type TanstackQueryDocsInput = {
/* Documentation path from the index (e.g., '/start/latest/docs/framework/react/overview'). Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling the matching codemode.tanstack_index() first. /
path: string;
};
type TanstackQueryDocsOutput = {
path: string;
url?: string;
content?: string;
anchor?: string | null;
error?: string;
message?: string;
};
type DocsSearchInput = {
/* Free-text search query. Tokenized on whitespace and punctuation. /
query: string;
/* Stacks to search (e.g. ['nextjs', 'react']). Defaults to all registered stacks. /
stacks?: string[];
/* Maximum matches to return. Default 10. /
limit?: number;
/* When true, fan out doc fetches in parallel and attach .content to each match. One MCP call yields ranked results AND their full markdown. */
fetch?: boolean;
};
type DocsSearchOutput = {
matches: {
stack: string;
path: string;
url: string;
title: string;
description?: string;
score: number;
content?: string;
error?: string;
}[];
};
type NextjsIndexOutput = string;
type ReactIndexOutput = string;
type TurborepoIndexOutput = string;
type SupabaseIndexOutput = string;
type EffectIndexOutput = string;
type OxcIndexOutput = string;
type TanstackStartIndexOutput = string;
type TanstackRouterIndexOutput = string;
type TanstackQueryIndexOutput = string;
/**
Sandbox SDK. Each method calls an MCP tool over the wire (one network round-trip per call).
Fan out parallel calls with Promise.all to batch fetches into one server hop. / declare const codemode: { /*
Fetch Next.js official documentation by path. Scoped to App Router on Next.js 16; Pages Router paths are rejected. IMPORTANT: Call codemode.nextjs_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.nextjs_index() to get the documentation index 2. Find the relevant path(s) in the index 3. Call codemode.nextjs_docs({ path }) — fan out parallel fetches with Promise.all when looking up multiple docs at once
@param input.path - Documentation path (e.g., '/docs/app/api-reference/functions/refresh'). Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling codemode.nextjs_index() first. App Router only — Pages Router paths ('/docs/pages/...') are not supported.
@param input.anchor - Optional anchor/section from the index (e.g., 'usage'). Included in response metadata to indicate relevant section. / nextjs_docs: (input: NextjsDocsInput) => Promise; /*
Fetch React official documentation by path. IMPORTANT: Call codemode.react_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.react_index() to get the documentation index 2. Find the relevant path(s) in the index (paths include the .md suffix) 3. Call codemode.react_docs({ path }) — fan out parallel fetches with Promise.all when looking up multiple docs at once
@param input.path - Documentation path (e.g., '/learn/react-compiler.md' or '/reference/react/useState.md'). The path includes the .md suffix as listed in the index. Get valid paths by calling codemode.react_index() first. / react_docs: (input: ReactDocsInput) => Promise; /*
Fetch Turborepo official documentation by path. IMPORTANT: Call codemode.turborepo_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.turborepo_index() to get the documentation index 2. Find the relevant path(s) in the index (paths include the .md suffix) 3. Call codemode.turborepo_docs({ path }) — fan out parallel fetches with Promise.all when looking up multiple docs at once
@param input.path - Documentation path (e.g., '/guides/tools/docker.md', '/reference/run.md', or 'index.md'). Paths are relative to '/docs/'; the tool resolves them under turborepo.dev/docs/. Get valid paths by calling codemode.turborepo_index() first. / turborepo_docs: (input: TurborepoDocsInput) => Promise; /*
Fetch a Supabase guide by path. Scoped to /docs/guides/** content. IMPORTANT: Call codemode.supabase_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.supabase_index() to get the guides index 2. Find the relevant path(s) in the index 3. Call codemode.supabase_docs({ path }) — no .md suffix, the tool appends it. Fan out parallel fetches with Promise.all when looking up multiple guides at once
@param input.path - Guide path (e.g., '/docs/guides/functions/auth'). Must start with '/docs/guides/'. Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling codemode.supabase_index() first. / supabase_docs: (input: SupabaseDocsInput) => Promise; /*
Fetch Effect (TypeScript) official documentation by path. IMPORTANT: Call codemode.effect_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.effect_index() to get the documentation index 2. Find the relevant path(s) in the index 3. Call codemode.effect_docs({ path }) — fan out parallel fetches with Promise.all when looking up multiple docs at once Effect publishes a single concatenated llms-full.txt; this tool slices the requested page out of it, so all fetches share one cached download.
@param input.path - Documentation path (e.g., '/docs/batching/' or '/docs/schema/introduction/'). Paths are pathnames from effect.website with the trailing slash, exactly as listed in the index. Get valid paths by calling codemode.effect_index() first. / effect_docs: (input: EffectDocsInput) => Promise; /*
Fetch Oxc (Oxlint + Oxfmt) official documentation by path. IMPORTANT: Call codemode.oxc_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.oxc_index() to get the documentation index 2. Find the relevant path(s) in the index (paths include the .md suffix) 3. Call codemode.oxc_docs({ path }) — fan out parallel fetches with Promise.all when looking up multiple docs at once
@param input.path - Documentation path from the index (e.g., '/docs/guide/usage/linter/automatic-fixes.md'). Paths already include the '.md' suffix as listed in the index. Get valid paths by calling codemode.oxc_index() first. / oxc_docs: (input: OxcDocsInput) => Promise; /*
Fetch TanStack Start official documentation by path. IMPORTANT: Call codemode.tanstack_start_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.tanstack_start_index() to get the documentation index 2. Find the relevant path(s) in the index 3. Call codemode.tanstack_start_docs({ path }) — fan out parallel fetches with Promise.all when looking up multiple docs at once
@param input.path - Documentation path from the index (e.g., '/start/latest/docs/framework/react/overview'). Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling the matching codemode.tanstack__index() first. / tanstack_start_docs: (input: TanstackStartDocsInput) => Promise; /*
Fetch TanStack Router official documentation by path. IMPORTANT: Call codemode.tanstack_router_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.tanstack_router_index() to get the documentation index 2. Find the relevant path(s) in the index 3. Call codemode.tanstack_router_docs({ path }) — fan out parallel fetches with Promise.all when looking up multiple docs at once
@param input.path - Documentation path from the index (e.g., '/start/latest/docs/framework/react/overview'). Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling the matching codemode.tanstack__index() first. / tanstack_router_docs: (input: TanstackRouterDocsInput) => Promise; /*
Fetch TanStack Query official documentation by path. IMPORTANT: Call codemode.tanstack_query_index() first to get valid paths. Do NOT guess paths. Workflow: 1. Call codemode.tanstack_query_index() to get the documentation index 2. Find the relevant path(s) in the index 3. Call codemode.tanstack_query_docs({ path }) — fan out parallel fetches with Promise.all when looking up multiple docs at once
@param input.path - Documentation path from the index (e.g., '/start/latest/docs/framework/react/overview'). Do NOT include a '.md' suffix — the tool appends it. Get valid paths by calling the matching codemode.tanstack__index() first. / tanstack_query_docs: (input: TanstackQueryDocsInput) => Promise; /*
Cross-stack ranked search over the registered documentation indexes. Use this when the agent's question spans more than one stack (e.g. "how does caching work in Next.js and React?") or when the agent doesn't know which stack the answer lives in. One call returns ranked matches across all requested stacks; pass fetch: true to also pull each match's markdown content in the same round-trip. Workflow: 1. Call codemode.docs_search({ query: "caching", stacks: ["nextjs", "react"], limit: 5, fetch: true }) 2. The result is { matches: [{ stack, path, url, title, description?, score, content? }] } 3. Use the content directly, or fan out further codemode._docs() calls for additional pages.
@param input.query - Free-text search query. Tokenized on whitespace and punctuation.
@param input.stacks - Stacks to search (e.g. ['nextjs', 'react']). Defaults to all registered stacks.
@param input.limit - Maximum matches to return. Default 10.
@param input.fetch - When true, fan out doc fetches in parallel and attach
.contentto each match. One MCP call yields ranked results AND their full markdown. / docs_search: (input: DocsSearchInput) => Promise; /*Returns the raw Next.js (App Router, Next.js 16) documentation index. Search this output to find valid paths before calling
nextjs_docs. No arguments. / nextjs_index: () => Promise; /*Returns the raw React documentation index. Search this output to find valid paths before calling
react_docs. No arguments. / react_index: () => Promise; /*Returns the raw Turborepo documentation index. Search this output to find valid paths before calling
turborepo_docs. No arguments. / turborepo_index: () => Promise; /*Returns the raw Supabase guides documentation index. Search this output to find valid paths before calling
supabase_docs. No arguments. / supabase_index: () => Promise; /*Returns the raw Effect (TypeScript) documentation index. Search this output to find valid paths before calling
effect_docs. No arguments. / effect_index: () => Promise; /*Returns the raw Oxc (Oxlint + Oxfmt) documentation index. Search this output to find valid paths before calling
oxc_docs. No arguments. / oxc_index: () => Promise; /*Returns the raw TanStack Start documentation index. Search this output to find valid paths before calling
tanstack_start_docs. No arguments. / tanstack_start_index: () => Promise; /*Returns the raw TanStack Router documentation index. Search this output to find valid paths before calling
tanstack_router_docs. No arguments. / tanstack_router_index: () => Promise; /*Returns the raw TanStack Query documentation index. Search this output to find valid paths before calling
tanstack_query_docs. No arguments. */ tanstack_query_index: () => Promise; };
Example (parallel cross-stack survey, the common case): Example (parallel cross-stack survey): async () => { const [nextjsIdx, reactIdx, turborepoIdx, supabaseIdx, effectIdx, oxcIdx, tanstack_startIdx, tanstack_routerIdx, tanstack_queryIdx] = await Promise.all([ codemode.nextjs_index(), codemode.react_index(), codemode.turborepo_index(), codemode.supabase_index(), codemode.effect_index(), codemode.oxc_index(), codemode.tanstack_start_index(), codemode.tanstack_router_index(), codemode.tanstack_query_index(), ]); // Pick relevant paths from each index, then fan out doc fetches with another Promise.all. return { nextjsIdx, reactIdx, turborepoIdx, supabaseIdx, effectIdx, oxcIdx, tanstack_startIdx, tanstack_routerIdx, tanstack_queryIdx }; }
Return the value the caller needs. If you console.log, output is captured in a [logs] block alongside the result. For deeper patterns read the MCP resource citadel://docs/agent-usage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript async arrow function to execute |