@transcend-io/mcp-server-docs 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,8 +70,8 @@ See [CONTRIBUTING.md](../../../CONTRIBUTING.md#mcp-servers) for workspace layout
70
70
 
71
71
  ## Tools
72
72
 
73
- - `transcend_docs_list` — List/search the Transcend docs index (`llms.txt`); optional `section` and `keyword` filters
74
- - `transcend_docs_fetch` — Fetch full markdown for a docs article URL (host restricted to `docs.transcend.io`)
73
+ - `docs_list` — List/search the Transcend docs index (`llms.txt`); optional `section` and `keyword` filters
74
+ - `docs_fetch` — Fetch full markdown for a docs article URL (host restricted to `docs.transcend.io`)
75
75
 
76
76
  ## Related packages
77
77
 
package/dist/cli.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { t as getDocsTools } from "./tools-CbLvbjwK.mjs";
2
+ import { t as getDocsTools } from "./tools-Cc8ZQVE0.mjs";
3
3
  import { createMCPServer } from "@transcend-io/mcp-server-base";
4
4
  //#endregion
5
5
  //#region src/cli.ts
6
6
  createMCPServer({
7
7
  name: "transcend-mcp-docs",
8
- version: "0.2.2",
8
+ version: "0.3.1",
9
9
  requireStartupAuth: false,
10
10
  oauthScopes: [],
11
11
  getTools: getDocsTools
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as LLMS_TXT_URL, c as getIndex, i as DOCS_HOST, l as parseLlmsTxt, n as DocsListSchema, o as assertDocsHost, r as DocsFetchSchema, s as getBody, t as getDocsTools, u as resetDocsCachesForTests } from "./tools-CbLvbjwK.mjs";
1
+ import { a as LLMS_TXT_URL, c as getIndex, i as DOCS_HOST, l as parseLlmsTxt, n as DocsListSchema, o as assertDocsHost, r as DocsFetchSchema, s as getBody, t as getDocsTools, u as resetDocsCachesForTests } from "./tools-Cc8ZQVE0.mjs";
2
2
  export { DOCS_HOST, DocsFetchSchema, DocsListSchema, LLMS_TXT_URL, assertDocsHost, getBody, getDocsTools, getIndex, parseLlmsTxt, resetDocsCachesForTests };
@@ -88,14 +88,14 @@ function resetDocsCachesForTests() {
88
88
  //#region src/tools/docs_fetch.ts
89
89
  /** Maximum markdown characters returned per article (long pages are truncated). */
90
90
  const MAX_BODY_CHARS = 12e4;
91
- const DocsFetchSchema = z.object({ url: z.string().url().describe("Absolute https URL of a docs.transcend.io article (.md) from transcend_docs_list.") });
91
+ const DocsFetchSchema = z.object({ url: z.string().url().describe("Absolute https URL of a docs.transcend.io article (.md) from docs_list.") });
92
92
  function formatBody(body, url) {
93
93
  return `${body.length > MAX_BODY_CHARS ? `${body.slice(0, MAX_BODY_CHARS)}\n\n...(truncated)` : body}\n\nSource: ${url}`;
94
94
  }
95
95
  function createDocsFetchTool(_clients) {
96
96
  return defineTool({
97
- name: "transcend_docs_fetch",
98
- description: "Fetch full markdown content for a Transcend documentation article by URL. Use urls returned by transcend_docs_list.",
97
+ name: "docs_fetch",
98
+ description: "Fetch full markdown content for a Transcend documentation article by URL. Use urls returned by docs_list.",
99
99
  category: "Documentation",
100
100
  readOnly: true,
101
101
  requireAuth: false,
@@ -135,8 +135,8 @@ function filterEntries(entries, section, keyword) {
135
135
  }
136
136
  function createDocsListTool(_clients) {
137
137
  return defineTool({
138
- name: "transcend_docs_list",
139
- description: "List Transcend documentation articles from the public docs index. Pick the best matching url, then call transcend_docs_fetch for full markdown content.",
138
+ name: "docs_list",
139
+ description: "List Transcend documentation articles from the public docs index. Pick the best matching url, then call docs_fetch for full markdown content.",
140
140
  category: "Documentation",
141
141
  readOnly: true,
142
142
  requireAuth: false,
@@ -160,4 +160,4 @@ function getDocsTools(_clients) {
160
160
  //#endregion
161
161
  export { LLMS_TXT_URL as a, getIndex as c, DOCS_HOST as i, parseLlmsTxt as l, DocsListSchema as n, assertDocsHost as o, DocsFetchSchema as r, getBody as s, getDocsTools as t, resetDocsCachesForTests as u };
162
162
 
163
- //# sourceMappingURL=tools-CbLvbjwK.mjs.map
163
+ //# sourceMappingURL=tools-Cc8ZQVE0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools-Cc8ZQVE0.mjs","names":[],"sources":["../src/docsIndex.ts","../src/tools/docs_fetch.ts","../src/tools/docs_list.ts","../src/tools/index.ts"],"sourcesContent":["import { LRUCache } from 'lru-cache';\n\n/** Public docs index URL (llms.txt). */\nexport const LLMS_TXT_URL = 'https://docs.transcend.io/llms.txt';\n\n/** Allowed hostname for fetched documentation articles. */\nexport const DOCS_HOST = 'docs.transcend.io';\n\nconst INDEX_CACHE_KEY = 'index';\nconst DEFAULT_INDEX_TTL_MS = 24 * 60 * 60 * 1000;\nconst DEFAULT_BODY_TTL_MS = 6 * 60 * 60 * 1000;\nconst FETCH_TIMEOUT_MS = 8_000;\nconst MAX_BODY_CACHE_ENTRIES = 400;\n\n/** A single article entry from llms.txt. */\nexport interface DocEntry {\n /** Section header from llms.txt (e.g. \"General\", \"Use Case Guides\"). */\n section: string;\n /** Human-readable article title. */\n title: string;\n /** Absolute URL to the article markdown (.md). */\n url: string;\n}\n\n/**\n * Parses llms.txt markdown into structured entries.\n * Expects `## Section` headers and `- [Title](url)` list items.\n */\nexport function parseLlmsTxt(raw: string): DocEntry[] {\n const entries: DocEntry[] = [];\n let currentSection = '';\n\n for (const line of raw.split('\\n')) {\n const sectionMatch = /^## (.+)$/.exec(line);\n if (sectionMatch?.[1]) {\n currentSection = sectionMatch[1].trim();\n continue;\n }\n\n const linkMatch = /^- \\[(.+)\\]\\((.+)\\)\\s*$/.exec(line);\n if (linkMatch?.[1] && linkMatch[2] && currentSection) {\n entries.push({\n section: currentSection,\n title: linkMatch[1].trim(),\n url: linkMatch[2].trim(),\n });\n }\n }\n\n return entries;\n}\n\nasync function fetchText(url: string, signal?: AbortSignal): Promise<string> {\n const response = await fetch(url, {\n headers: { Accept: 'text/markdown, text/plain' },\n signal: signal ?? AbortSignal.timeout(FETCH_TIMEOUT_MS),\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch ${url}: HTTP ${response.status}`);\n }\n return response.text();\n}\n\nconst indexCache = new LRUCache<string, DocEntry[]>({\n max: 1,\n ttl: DEFAULT_INDEX_TTL_MS,\n allowStale: true,\n allowStaleOnFetchRejection: true,\n fetchMethod: async (_key, _stale, { signal }) => {\n const raw = await fetchText(LLMS_TXT_URL, signal);\n return parseLlmsTxt(raw);\n },\n});\n\nconst bodyCache = new LRUCache<string, string>({\n max: MAX_BODY_CACHE_ENTRIES,\n ttl: DEFAULT_BODY_TTL_MS,\n allowStale: true,\n allowStaleOnFetchRejection: true,\n fetchMethod: async (url, _stale, { signal }) => fetchText(url, signal),\n});\n\n/** Returns the parsed llms.txt index (cached with TTL). */\nexport async function getIndex(): Promise<DocEntry[]> {\n const result = await indexCache.fetch(INDEX_CACHE_KEY);\n if (!result) {\n throw new Error('Failed to load documentation index');\n }\n return result;\n}\n\n/** Fetches and caches markdown body for a docs.transcend.io article URL. */\nexport async function getBody(url: string): Promise<string> {\n assertDocsHost(url);\n const result = await bodyCache.fetch(url);\n if (result === undefined) {\n throw new Error(`Failed to fetch documentation: ${url}`);\n }\n return result;\n}\n\n/** Validates that a URL targets docs.transcend.io (SSRF guard for fetch). */\nexport function assertDocsHost(url: string): void {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n throw new Error(`Invalid documentation URL: ${url}`);\n }\n if (parsed.hostname !== DOCS_HOST) {\n throw new Error(`URL host must be ${DOCS_HOST}, got ${parsed.hostname}`);\n }\n}\n\n/** Clears in-memory caches (for tests). */\nexport function resetDocsCachesForTests(): void {\n indexCache.clear();\n bodyCache.clear();\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { assertDocsHost, getBody } from '../docsIndex.js';\n\n/** Maximum markdown characters returned per article (long pages are truncated). */\nconst MAX_BODY_CHARS = 120_000;\n\nexport const DocsFetchSchema = z.object({\n url: z\n .string()\n .url()\n .describe('Absolute https URL of a docs.transcend.io article (.md) from docs_list.'),\n});\nexport type DocsFetchInput = z.infer<typeof DocsFetchSchema>;\n\nfunction formatBody(body: string, url: string): string {\n const truncated =\n body.length > MAX_BODY_CHARS ? `${body.slice(0, MAX_BODY_CHARS)}\\n\\n...(truncated)` : body;\n return `${truncated}\\n\\nSource: ${url}`;\n}\n\nexport function createDocsFetchTool(_clients?: ToolClients) {\n return defineTool({\n name: 'docs_fetch',\n description:\n 'Fetch full markdown content for a Transcend documentation article by URL. ' +\n 'Use urls returned by docs_list.',\n category: 'Documentation',\n readOnly: true,\n requireAuth: false,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n zodSchema: DocsFetchSchema,\n handler: async ({ url }) => {\n assertDocsHost(url);\n const body = await getBody(url);\n return createToolResult(true, {\n url,\n markdown: formatBody(body, url),\n });\n },\n });\n}\n","import { createListResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { getIndex, type DocEntry } from '../docsIndex.js';\n\nexport const DocsListSchema = z.object({\n section: z\n .string()\n .optional()\n .describe('Filter articles to this llms.txt section name (exact match).'),\n keyword: z\n .string()\n .optional()\n .describe('Case-insensitive substring filter applied to article titles.'),\n});\nexport type DocsListInput = z.infer<typeof DocsListSchema>;\n\nfunction filterEntries(entries: DocEntry[], section?: string, keyword?: string) {\n let result = entries;\n if (section) {\n result = result.filter((entry) => entry.section === section);\n }\n if (keyword) {\n const lower = keyword.toLowerCase();\n result = result.filter((entry) => entry.title.toLowerCase().includes(lower));\n }\n return result.map(({ title, section: entrySection, url }) => ({\n title,\n section: entrySection,\n url,\n }));\n}\n\nexport function createDocsListTool(_clients?: ToolClients) {\n return defineTool({\n name: 'docs_list',\n description:\n 'List Transcend documentation articles from the public docs index. ' +\n 'Pick the best matching url, then call docs_fetch for full markdown content.',\n category: 'Documentation',\n readOnly: true,\n requireAuth: false,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n zodSchema: DocsListSchema,\n handler: async ({ section, keyword }) => {\n const entries = await getIndex();\n const filtered = filterEntries(entries, section, keyword);\n return createListResult(filtered, { totalCount: filtered.length });\n },\n });\n}\n","import type { ToolDefinition, ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { createDocsFetchTool } from './docs_fetch.js';\nimport { createDocsListTool } from './docs_list.js';\n\nexport function getDocsTools(_clients?: ToolClients): ToolDefinition[] {\n return [createDocsListTool(), createDocsFetchTool()];\n}\n"],"mappings":";;;;AAGA,MAAa,eAAe;;AAG5B,MAAa,YAAY;AAEzB,MAAM,kBAAkB;AACxB,MAAM,uBAAuB,OAAU,KAAK;AAC5C,MAAM,sBAAsB,MAAS,KAAK;AAC1C,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;;;;;AAgB/B,SAAgB,aAAa,KAAyB;CACpD,MAAM,UAAsB,EAAE;CAC9B,IAAI,iBAAiB;AAErB,MAAK,MAAM,QAAQ,IAAI,MAAM,KAAK,EAAE;EAClC,MAAM,eAAe,YAAY,KAAK,KAAK;AAC3C,MAAI,eAAe,IAAI;AACrB,oBAAiB,aAAa,GAAG,MAAM;AACvC;;EAGF,MAAM,YAAY,0BAA0B,KAAK,KAAK;AACtD,MAAI,YAAY,MAAM,UAAU,MAAM,eACpC,SAAQ,KAAK;GACX,SAAS;GACT,OAAO,UAAU,GAAG,MAAM;GAC1B,KAAK,UAAU,GAAG,MAAM;GACzB,CAAC;;AAIN,QAAO;;AAGT,eAAe,UAAU,KAAa,QAAuC;CAC3E,MAAM,WAAW,MAAM,MAAM,KAAK;EAChC,SAAS,EAAE,QAAQ,6BAA6B;EAChD,QAAQ,UAAU,YAAY,QAAQ,iBAAiB;EACxD,CAAC;AACF,KAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,mBAAmB,IAAI,SAAS,SAAS,SAAS;AAEpE,QAAO,SAAS,MAAM;;AAGxB,MAAM,aAAa,IAAI,SAA6B;CAClD,KAAK;CACL,KAAK;CACL,YAAY;CACZ,4BAA4B;CAC5B,aAAa,OAAO,MAAM,Q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ACX,SAAS,OAAO,EAAE,UAAU;AAC1B,kBAAe,IAAI;AAEnB,UAAO,iBAAiB,MAAM;IAC5B;IACA,UAAU,WAAW,MAHJ,QAAQ,IAAI,EAGF,IAAI;IAChC,CAAC;;EAEL,CAAC;;;;ACpCJ,MAAa,iBAAiB,EAAE,OAAO;CACrC,SAAS,EACN,QAAQ,CACR,UAAU,CACV,SAAS,+DAA+D;CAC3E,SAAS,EACN,QAAQ,CACR,UAAU,CACV,SAAS,+DAA+D;CAC5E,CAAC;AAGF,SAAS,cAAc,SAAqB,SAAkB,SAAkB;CAC9E,IAAI,SAAS;AACb,KAAI,QACF,UAAS,OAAO,QAAQ,UAAU,MAAM,YAAY,QAAQ;AAE9D,KAAI,SAAS;EACX,MAAM,QAAQ,QAAQ,aAAa;AACnC,WAAS,OAAO,QAAQ,UAAU,MAAM,MAAM,aAAa,CAAC,SAAS,MAAM,CAAC;;AAE9E,QAAO,OAAO,KAAK,EAAE,OAAO,SAAS,cAAc,WAAW;EAC5D;EACA,SAAS;EACT;EACD,EAAE;;AAGL,SAAgB,mBAAmB,UAAwB;AACzD,QAAO,WAAW;EAChB,MAAM;EACN,aACE;EAEF,UAAU;EACV,UAAU;EACV,aAAa;EACb,aAAa;GAAE,cAAc;GAAM,iBAAiB;GAAO,gBAAgB;GAAM;EACjF,WAAW;EACX,SAAS,OAAO,EAAE,SAAS,cAAc;GAEvC,MAAM,WAAW,cAAc,MADT,UAAU,EACQ,SAAS,QAAQ;AACzD,UAAO,iBAAiB,UAAU,EAAE,YAAY,SAAS,QAAQ,CAAC;;EAErE,CAAC;;;;AC3CJ,SAAgB,aAAa,UAA0C;AACrE,QAAO,CAAC,oBAAoB,EAAE,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transcend-io/mcp-server-docs",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "description": "Transcend MCP Server — Documentation lookup tools.",
5
5
  "homepage": "https://github.com/transcend-io/tools/tree/main/packages/mcp/mcp-server-docs",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  "@modelcontextprotocol/sdk": "^1.29.0",
34
34
  "lru-cache": "^11.5.1",
35
35
  "zod": "^4.3.6",
36
- "@transcend-io/mcp-server-base": "0.6.0"
36
+ "@transcend-io/mcp-server-base": "0.6.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@arethetypeswrong/cli": "^0.18.2",
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools-CbLvbjwK.mjs","names":[],"sources":["../src/docsIndex.ts","../src/tools/docs_fetch.ts","../src/tools/docs_list.ts","../src/tools/index.ts"],"sourcesContent":["import { LRUCache } from 'lru-cache';\n\n/** Public docs index URL (llms.txt). */\nexport const LLMS_TXT_URL = 'https://docs.transcend.io/llms.txt';\n\n/** Allowed hostname for fetched documentation articles. */\nexport const DOCS_HOST = 'docs.transcend.io';\n\nconst INDEX_CACHE_KEY = 'index';\nconst DEFAULT_INDEX_TTL_MS = 24 * 60 * 60 * 1000;\nconst DEFAULT_BODY_TTL_MS = 6 * 60 * 60 * 1000;\nconst FETCH_TIMEOUT_MS = 8_000;\nconst MAX_BODY_CACHE_ENTRIES = 400;\n\n/** A single article entry from llms.txt. */\nexport interface DocEntry {\n /** Section header from llms.txt (e.g. \"General\", \"Use Case Guides\"). */\n section: string;\n /** Human-readable article title. */\n title: string;\n /** Absolute URL to the article markdown (.md). */\n url: string;\n}\n\n/**\n * Parses llms.txt markdown into structured entries.\n * Expects `## Section` headers and `- [Title](url)` list items.\n */\nexport function parseLlmsTxt(raw: string): DocEntry[] {\n const entries: DocEntry[] = [];\n let currentSection = '';\n\n for (const line of raw.split('\\n')) {\n const sectionMatch = /^## (.+)$/.exec(line);\n if (sectionMatch?.[1]) {\n currentSection = sectionMatch[1].trim();\n continue;\n }\n\n const linkMatch = /^- \\[(.+)\\]\\((.+)\\)\\s*$/.exec(line);\n if (linkMatch?.[1] && linkMatch[2] && currentSection) {\n entries.push({\n section: currentSection,\n title: linkMatch[1].trim(),\n url: linkMatch[2].trim(),\n });\n }\n }\n\n return entries;\n}\n\nasync function fetchText(url: string, signal?: AbortSignal): Promise<string> {\n const response = await fetch(url, {\n headers: { Accept: 'text/markdown, text/plain' },\n signal: signal ?? AbortSignal.timeout(FETCH_TIMEOUT_MS),\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch ${url}: HTTP ${response.status}`);\n }\n return response.text();\n}\n\nconst indexCache = new LRUCache<string, DocEntry[]>({\n max: 1,\n ttl: DEFAULT_INDEX_TTL_MS,\n allowStale: true,\n allowStaleOnFetchRejection: true,\n fetchMethod: async (_key, _stale, { signal }) => {\n const raw = await fetchText(LLMS_TXT_URL, signal);\n return parseLlmsTxt(raw);\n },\n});\n\nconst bodyCache = new LRUCache<string, string>({\n max: MAX_BODY_CACHE_ENTRIES,\n ttl: DEFAULT_BODY_TTL_MS,\n allowStale: true,\n allowStaleOnFetchRejection: true,\n fetchMethod: async (url, _stale, { signal }) => fetchText(url, signal),\n});\n\n/** Returns the parsed llms.txt index (cached with TTL). */\nexport async function getIndex(): Promise<DocEntry[]> {\n const result = await indexCache.fetch(INDEX_CACHE_KEY);\n if (!result) {\n throw new Error('Failed to load documentation index');\n }\n return result;\n}\n\n/** Fetches and caches markdown body for a docs.transcend.io article URL. */\nexport async function getBody(url: string): Promise<string> {\n assertDocsHost(url);\n const result = await bodyCache.fetch(url);\n if (result === undefined) {\n throw new Error(`Failed to fetch documentation: ${url}`);\n }\n return result;\n}\n\n/** Validates that a URL targets docs.transcend.io (SSRF guard for fetch). */\nexport function assertDocsHost(url: string): void {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n throw new Error(`Invalid documentation URL: ${url}`);\n }\n if (parsed.hostname !== DOCS_HOST) {\n throw new Error(`URL host must be ${DOCS_HOST}, got ${parsed.hostname}`);\n }\n}\n\n/** Clears in-memory caches (for tests). */\nexport function resetDocsCachesForTests(): void {\n indexCache.clear();\n bodyCache.clear();\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { assertDocsHost, getBody } from '../docsIndex.js';\n\n/** Maximum markdown characters returned per article (long pages are truncated). */\nconst MAX_BODY_CHARS = 120_000;\n\nexport const DocsFetchSchema = z.object({\n url: z\n .string()\n .url()\n .describe('Absolute https URL of a docs.transcend.io article (.md) from transcend_docs_list.'),\n});\nexport type DocsFetchInput = z.infer<typeof DocsFetchSchema>;\n\nfunction formatBody(body: string, url: string): string {\n const truncated =\n body.length > MAX_BODY_CHARS ? `${body.slice(0, MAX_BODY_CHARS)}\\n\\n...(truncated)` : body;\n return `${truncated}\\n\\nSource: ${url}`;\n}\n\nexport function createDocsFetchTool(_clients?: ToolClients) {\n return defineTool({\n name: 'transcend_docs_fetch',\n description:\n 'Fetch full markdown content for a Transcend documentation article by URL. ' +\n 'Use urls returned by transcend_docs_list.',\n category: 'Documentation',\n readOnly: true,\n requireAuth: false,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n zodSchema: DocsFetchSchema,\n handler: async ({ url }) => {\n assertDocsHost(url);\n const body = await getBody(url);\n return createToolResult(true, {\n url,\n markdown: formatBody(body, url),\n });\n },\n });\n}\n","import { createListResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { getIndex, type DocEntry } from '../docsIndex.js';\n\nexport const DocsListSchema = z.object({\n section: z\n .string()\n .optional()\n .describe('Filter articles to this llms.txt section name (exact match).'),\n keyword: z\n .string()\n .optional()\n .describe('Case-insensitive substring filter applied to article titles.'),\n});\nexport type DocsListInput = z.infer<typeof DocsListSchema>;\n\nfunction filterEntries(entries: DocEntry[], section?: string, keyword?: string) {\n let result = entries;\n if (section) {\n result = result.filter((entry) => entry.section === section);\n }\n if (keyword) {\n const lower = keyword.toLowerCase();\n result = result.filter((entry) => entry.title.toLowerCase().includes(lower));\n }\n return result.map(({ title, section: entrySection, url }) => ({\n title,\n section: entrySection,\n url,\n }));\n}\n\nexport function createDocsListTool(_clients?: ToolClients) {\n return defineTool({\n name: 'transcend_docs_list',\n description:\n 'List Transcend documentation articles from the public docs index. ' +\n 'Pick the best matching url, then call transcend_docs_fetch for full markdown content.',\n category: 'Documentation',\n readOnly: true,\n requireAuth: false,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n zodSchema: DocsListSchema,\n handler: async ({ section, keyword }) => {\n const entries = await getIndex();\n const filtered = filterEntries(entries, section, keyword);\n return createListResult(filtered, { totalCount: filtered.length });\n },\n });\n}\n","import type { ToolDefinition, ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { createDocsFetchTool } from './docs_fetch.js';\nimport { createDocsListTool } from './docs_list.js';\n\nexport function getDocsTools(_clients?: ToolClients): ToolDefinition[] {\n return [createDocsListTool(), createDocsFetchTool()];\n}\n"],"mappings":";;;;AAGA,MAAa,eAAe;;AAG5B,MAAa,YAAY;AAEzB,MAAM,kBAAkB;AACxB,MAAM,uBAAuB,OAAU,KAAK;AAC5C,MAAM,sBAAsB,MAAS,KAAK;AAC1C,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;;;;;AAgB/B,SAAgB,aAAa,KAAyB;CACpD,MAAM,UAAsB,EAAE;CAC9B,IAAI,iBAAiB;AAErB,MAAK,MAAM,QAAQ,IAAI,MAAM,KAAK,EAAE;EAClC,MAAM,eAAe,YAAY,KAAK,KAAK;AAC3C,MAAI,eAAe,IAAI;AACrB,oBAAiB,aAAa,GAAG,MAAM;AACvC;;EAGF,MAAM,YAAY,0BAA0B,KAAK,KAAK;AACtD,MAAI,YAAY,MAAM,UAAU,MAAM,eACpC,SAAQ,KAAK;GACX,SAAS;GACT,OAAO,UAAU,GAAG,MAAM;GAC1B,KAAK,UAAU,GAAG,MAAM;GACzB,CAAC;;AAIN,QAAO;;AAGT,eAAe,UAAU,KAAa,QAAuC;CAC3E,MAAM,WAAW,MAAM,MAAM,KAAK;EAChC,SAAS,EAAE,QAAQ,6BAA6B;EAChD,QAAQ,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