@taiga-ui/mcp 0.2.1 → 0.2.2

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/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { start } from './server/server.js';
3
+ import { logError } from './utils/logger.js';
4
+ start().catch((err) => {
5
+ logError('Unhandled startup error', err);
6
+ process.exit(1);
7
+ });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC3B,QAAQ,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;IAEzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=doc-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doc-types.js","sourceRoot":"","sources":["../../src/schemas/doc-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import { parseContent } from '../utils/parse-content.js';
2
+ import { state } from './server.js';
3
+ // 6-hour refresh window
4
+ const REFRESH_INTERVAL_MS = 6 * 60 * 60 * 1000;
5
+ export async function fetchSource() {
6
+ const argProvidedUrl = process.argv
7
+ .find((arg) => arg.startsWith('--source-url='))
8
+ ?.split('=')[1];
9
+ const sourceUrl = argProvidedUrl ?? process.env.SOURCE_URL;
10
+ if (!sourceUrl) {
11
+ throw new Error('Source URL not provided. Set SOURCE_URL or pass --source-url=...');
12
+ }
13
+ const response = await fetch(sourceUrl).catch((error) => {
14
+ throw new Error(`Network error fetching documentation source: ${error instanceof Error ? error.message : String(error)}`);
15
+ });
16
+ if (!response.ok) {
17
+ throw new Error(`Failed to fetch documentation (HTTP ${response.status} ${response.statusText}) from ${sourceUrl}`);
18
+ }
19
+ const content = await response.text();
20
+ if (!content.trim()) {
21
+ throw new Error(`Fetched documentation from ${sourceUrl} is empty.`);
22
+ }
23
+ return { url: sourceUrl, content };
24
+ }
25
+ export async function ensureSourceLoaded() {
26
+ const isContentStale = !state.lastLoadedAt || Date.now() - state.lastLoadedAt > REFRESH_INTERVAL_MS;
27
+ if (!state.sections.length || isContentStale) {
28
+ const { url, content } = await fetchSource();
29
+ parseContent(content, url);
30
+ state.lastLoadedAt = Date.now();
31
+ }
32
+ }
33
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/server/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAElC,wBAAwB;AACxB,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,WAAW;IAC7B,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI;SAC9B,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QAC/C,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpB,MAAM,SAAS,GAAG,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAE3D,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACX,kEAAkE,CACrE,CAAC;IACN,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC7D,MAAM,IAAI,KAAK,CACX,gDAAgD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC3G,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACX,uCAAuC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,UAAU,SAAS,EAAE,CACrG,CAAC;IACN,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEtC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,YAAY,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,EAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAC,CAAC;AACrC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACpC,MAAM,cAAc,GAChB,CAAC,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,mBAAmB,CAAC;IAEjF,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,cAAc,EAAE,CAAC;QAC3C,MAAM,EAAC,GAAG,EAAE,OAAO,EAAC,GAAG,MAAM,WAAW,EAAE,CAAC;QAE3C,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAE3B,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACpC,CAAC;AACL,CAAC"}
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import packageJson from '../../package.json' with { type: 'json' };
5
+ import { registerAllTools } from '../tools/index.js';
6
+ import { logError, logInfo } from '../utils/logger.js';
7
+ import { ensureSourceLoaded } from './fetch.js';
8
+ export const state = {
9
+ sections: [],
10
+ overview: undefined,
11
+ migrationGuide: undefined,
12
+ sourceUrl: undefined,
13
+ lastLoadedAt: undefined,
14
+ };
15
+ const server = new McpServer({
16
+ name: 'taiga-ui-mcp',
17
+ version: packageJson.version,
18
+ }, {
19
+ capabilities: { tools: {} },
20
+ instructions: `
21
+ <General Purpose>
22
+ This server provides programmatic access to Taiga UI component documentation for AI assistants.
23
+ Use these tools to discover, understand, and retrieve usage examples for Taiga UI components.
24
+ </General Purpose>
25
+
26
+ <Core Workflows & Tool Guide>
27
+ * **1. Get Documentation Overview (Start Here):** Always begin by calling \`get_overview\` to retrieve the structured documentation header with installation instructions, critical notices, and general guidance.
28
+
29
+ * **2. Discover Components:** Call \`get_list_components\` to see all available Taiga UI components. Use the optional \`query\` parameter for fuzzy filtering to find specific components.
30
+
31
+ * **3. Get Component Examples:** Once you identify needed component(s), call \`get_component_example\` with component name(s) to retrieve full documentation and code examples.
32
+
33
+ * **4. Get Migration Guide:** Call \`get_migration_guide\` for step-by-step migration instructions, troubleshooting, and common issues when updating Taiga UI versions.
34
+ </Core Workflows & Tool Guide>
35
+
36
+ <Key Concepts>
37
+ * **Component Categories:** Components are organized by category (UI elements, forms, layouts, etc.)
38
+ * **Packages:** Components belong to different packages (CORE, KIT, etc.)
39
+ * **Fuzzy Matching:** Component queries support fuzzy matching for flexible searching.
40
+ </Key Concepts>
41
+ `,
42
+ });
43
+ registerAllTools(server);
44
+ export async function start() {
45
+ try {
46
+ await ensureSourceLoaded();
47
+ }
48
+ catch (error) {
49
+ logError('Initial source load failed', error);
50
+ }
51
+ const transport = new StdioServerTransport();
52
+ await server.connect(transport);
53
+ logInfo(`Angular Taiga UI MCP Server running. Fetched source components: ${state.sections.length}`);
54
+ }
55
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","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{ z } from 'zod';
2
+ import { ensureSourceLoaded } from '../server/fetch.js';
3
+ import { buildQueryResults } from '../utils/query-results.js';
4
+ export function registerGetComponentExampleTool(server) {
5
+ server.registerTool('get_component_example', {
6
+ title: 'Get Component Example',
7
+ description: 'Return section-related content snippets (formerly examples) for specified documentation section name(s). The presence of id indicates a successful match.',
8
+ inputSchema: { names: z.array(z.string().min(2)).min(1) },
9
+ outputSchema: {
10
+ results: z.array(z.object({
11
+ query: z.string(),
12
+ id: z.string().optional(),
13
+ package: z.string().nullable().optional(),
14
+ type: z.string().nullable().optional(),
15
+ suggestions: z.array(z.string()).optional(),
16
+ content: z.array(z.string()).optional(),
17
+ })),
18
+ matched: z.number(),
19
+ },
20
+ }, async ({ names }) => {
21
+ if (!names.length) {
22
+ const output = { error: 'Provide at least one name in names array.' };
23
+ return {
24
+ content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
25
+ structuredContent: output,
26
+ };
27
+ }
28
+ await ensureSourceLoaded();
29
+ const { results, matches } = buildQueryResults(names);
30
+ const output = { results, matched: matches };
31
+ return {
32
+ content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
33
+ structuredContent: output,
34
+ };
35
+ });
36
+ }
37
+ //# sourceMappingURL=get-component-example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-component-example.js","sourceRoot":"","sources":["../../src/tools/get-component-example.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAE5D,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC7D,MAAM,CAAC,YAAY,CACf,uBAAuB,EACvB;QACI,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACP,2JAA2J;QAC/J,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,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C,CAAC;QAE3C,OAAO;YACH,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAC,CAAC;YAChE,iBAAiB,EAAE,MAAM;SAC5B,CAAC;IACN,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { ensureSourceLoaded } from '../server/fetch.js';
3
+ import { constructComponentsList } from '../utils/list-components.js';
4
+ export function registerGetListComponentsTool(server) {
5
+ server.registerTool('get_list_components', {
6
+ title: 'List Components',
7
+ description: 'List all Taiga UI documentation section IDs (structured JSON only).',
8
+ inputSchema: { query: z.string().optional().default('') },
9
+ outputSchema: {
10
+ items: z.array(z.object({
11
+ id: z.string(),
12
+ name: z.string(),
13
+ category: z.string(),
14
+ package: z.string().nullable(),
15
+ type: z.string().nullable(),
16
+ })),
17
+ },
18
+ }, async ({ query }) => {
19
+ await ensureSourceLoaded();
20
+ const output = { items: constructComponentsList(query) };
21
+ return {
22
+ content: [
23
+ {
24
+ type: 'text',
25
+ text: JSON.stringify(output, null, 2),
26
+ },
27
+ ],
28
+ structuredContent: output,
29
+ };
30
+ });
31
+ }
32
+ //# sourceMappingURL=get-list-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-list-components.js","sourceRoot":"","sources":["../../src/tools/get-list-components.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AAEpE,MAAM,UAAU,6BAA6B,CAAC,MAAiB;IAC3D,MAAM,CAAC,YAAY,CACf,qBAAqB,EACrB;QACI,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACP,qEAAqE;QACzE,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAC;QACvD,YAAY,EAAE;YACV,KAAK,EAAE,CAAC,CAAC,KAAK,CACV,CAAC,CAAC,MAAM,CAAC;gBACL,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;gBACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;gBAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;gBACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;gBAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;aAC9B,CAAC,CACL;SACJ;KACJ,EACD,KAAK,EAAE,EAAC,KAAK,EAAmB,EAAE,EAAE;QAChC,MAAM,kBAAkB,EAAE,CAAC;QAE3B,MAAM,MAAM,GAAG,EAAC,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAC,EAAC,CAAC;QAEvD,OAAO;YACH,OAAO,EAAE;gBACL;oBACI,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACxC;aACJ;YACD,iBAAiB,EAAE,MAAM;SAC5B,CAAC;IACN,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ import { ensureSourceLoaded } from '../server/fetch.js';
3
+ import { state } from '../server/server.js';
4
+ import { parseMigrationGuide } from '../utils/extract-migration-guide.js';
5
+ export function registerGetMigrationGuideTool(server) {
6
+ server.registerTool('get_migration_guide', {
7
+ title: 'Get Migration Guide',
8
+ description: 'Returns the complete Migration Guide for Taiga UI updates. Includes step-by-step migration instructions, troubleshooting, and common issues. Call this tool when you need to migrate between Taiga UI versions.',
9
+ inputSchema: z.object({}).optional(),
10
+ outputSchema: {
11
+ title: z.string(),
12
+ introduction: z.array(z.string()),
13
+ sections: z.array(z.object({
14
+ title: z.string(),
15
+ content: z.array(z.string()),
16
+ codeBlocks: z.array(z.string()).optional(),
17
+ subsections: z
18
+ .array(z.object({
19
+ title: z.string(),
20
+ content: z.array(z.string()),
21
+ codeBlocks: z.array(z.string()).optional(),
22
+ }))
23
+ .optional(),
24
+ })),
25
+ },
26
+ }, async () => {
27
+ await ensureSourceLoaded();
28
+ if (!state.migrationGuide?.trim()) {
29
+ return {
30
+ content: [
31
+ {
32
+ type: 'text',
33
+ text: 'Migration Guide is not available. Ensure the source file contains the Migration Guide section.',
34
+ },
35
+ ],
36
+ };
37
+ }
38
+ const parsed = parseMigrationGuide(state.migrationGuide);
39
+ const output = {
40
+ title: parsed.title,
41
+ introduction: parsed.introduction,
42
+ sections: parsed.sections.map((section) => {
43
+ const sectionData = {
44
+ title: section.title,
45
+ content: section.content,
46
+ };
47
+ if (section.codeBlocks && section.codeBlocks.length > 0) {
48
+ sectionData.codeBlocks = section.codeBlocks;
49
+ }
50
+ if (section.subsections && section.subsections.length > 0) {
51
+ sectionData.subsections = section.subsections.map((sub) => {
52
+ const subData = {
53
+ title: sub.title,
54
+ content: sub.content,
55
+ };
56
+ if (sub.codeBlocks && sub.codeBlocks.length > 0) {
57
+ subData.codeBlocks = sub.codeBlocks;
58
+ }
59
+ return subData;
60
+ });
61
+ }
62
+ return sectionData;
63
+ }),
64
+ };
65
+ return {
66
+ content: [
67
+ {
68
+ type: 'text',
69
+ text: JSON.stringify(output, null, 2),
70
+ },
71
+ ],
72
+ structuredContent: output,
73
+ };
74
+ });
75
+ }
76
+ //# sourceMappingURL=get-migration-guide.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-migration-guide.js","sourceRoot":"","sources":["../../src/tools/get-migration-guide.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,KAAK,EAAC,MAA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AS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACxC;aACJ;YACD,iBAAiB,EAAE,MAAM;SAC5B,CAAC;IACN,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { z } from 'zod';
2
+ import { ensureSourceLoaded } from '../server/fetch.js';
3
+ import { state } from '../server/server.js';
4
+ import { parseHeaderSections, } from '../utils/extract-header.js';
5
+ export function registerGetOverviewTool(server) {
6
+ server.registerTool('get_overview', {
7
+ title: 'Get Documentation Overview',
8
+ description: 'Call this tool FIRST to retrieve the fully structured documentation header as JSON. Returns hierarchical sections with parsed content (no raw markdown). Includes installation instructions, critical notices, and subsections with their content and code blocks. This provides essential context before exploring specific components.',
9
+ inputSchema: z.object({}).optional(),
10
+ outputSchema: {
11
+ title: z.string(),
12
+ sections: z.array(z.object({
13
+ title: z.string(),
14
+ description: z.string().optional(),
15
+ criticalNotices: z.array(z.string()),
16
+ subsections: z.array(z.object({
17
+ title: z.string(),
18
+ content: z.array(z.string()),
19
+ sections: z
20
+ .array(z.object({
21
+ section: z.string(),
22
+ code: z.string().optional(),
23
+ }))
24
+ .optional(),
25
+ items: z
26
+ .array(z.object({
27
+ title: z.string(),
28
+ content: z.array(z.string()),
29
+ code: z.string().optional(),
30
+ sections: z
31
+ .array(z.object({
32
+ section: z.string(),
33
+ code: z.string().optional(),
34
+ }))
35
+ .optional(),
36
+ }))
37
+ .optional(),
38
+ })),
39
+ })),
40
+ totalComponents: z.number(),
41
+ sourceUrl: z.string().optional(),
42
+ },
43
+ }, async () => {
44
+ await ensureSourceLoaded();
45
+ const headerInfo = state.overview
46
+ ? parseHeaderSections(state.overview)
47
+ : {
48
+ title: 'Taiga UI Documentation',
49
+ sections: [],
50
+ };
51
+ const output = {
52
+ title: headerInfo.title,
53
+ sections: headerInfo.sections.map((section) => {
54
+ const sectionData = { title: section.title };
55
+ if (section.description) {
56
+ sectionData.description = section.description;
57
+ }
58
+ sectionData.criticalNotices = section.criticalNotices;
59
+ sectionData.subsections = section.subsections.map((sub) => {
60
+ const subData = {
61
+ title: sub.title,
62
+ content: sub.content,
63
+ };
64
+ // Only include sections if not empty
65
+ if (sub.sections && sub.sections.length > 0) {
66
+ subData.sections = sub.sections;
67
+ }
68
+ // Only include items if not empty
69
+ if (sub.items && sub.items.length > 0) {
70
+ subData.items = sub.items.map((item) => {
71
+ const itemData = {
72
+ title: item.title,
73
+ content: item.content,
74
+ };
75
+ if (item.code) {
76
+ itemData.code = item.code;
77
+ }
78
+ if (item.sections && item.sections.length > 0) {
79
+ itemData.sections = item.sections;
80
+ }
81
+ return itemData;
82
+ });
83
+ }
84
+ return subData;
85
+ });
86
+ return sectionData;
87
+ }),
88
+ totalComponents: state.sections.length,
89
+ sourceUrl: state.sourceUrl,
90
+ };
91
+ return {
92
+ content: [
93
+ {
94
+ type: 'text',
95
+ text: JSON.stringify(output, null, 2),
96
+ },
97
+ ],
98
+ structuredContent: output,
99
+ };
100
+ });
101
+ }
102
+ //# sourceMappingURL=get-overview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-overview.js","sourceRoot":"","sources":["../../src/tools/get-overview.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAEH,mBAAmB,GAEtB,MAAM,4BAA4B,CAAC;AAyBpC,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACrD,MAAM,CAAC,YAAY,CACf,cAAc,EACd;QACI,KAAK,EAAE,4BAA4B;QACnC,WAAW,EACP,0UAA0U;QAC9U,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QACpC,YAAY,EAAE;YACV,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;YACjB,QAAQ,EAAE,CAAC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EAAE;4BACxC,MAAM,QAAQ,GAAQ;gCAClB,KAAK,EAAE,IAAI,CAAC,KAAK;gCACjB,OAAO,EAAE,IAAI,CAAC,OAAO;6BACxB,CAAC;4BAEF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gCACZ,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;4BAC9B,CAAC;4BAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gCAC5C,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;4BACtC,CAAC;4BAED,OAAO,QAAQ,CAAC;wBACpB,CAAC,CAAC,CAAC;oBACP,CAAC;oBAED,OAAO,OAAO,CAAC;gBACnB,CAAC,CACJ,CAAC;gBAEF,OAAO,WAAW,CAAC;YACvB,CAAC,CAAC;YACF,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM;YACtC,SAAS,EAAE,KAAK,CAAC,SAAS;SAC7B,CAAC;QAEF,OAAO;YACH,OAAO,EAAE;gBACL;oBACI,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACxC;aACJ;YACD,iBAAiB,EAAE,MAAM;SAC5B,CAAC;IACN,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { registerGetComponentExampleTool } from './get-component-example.js';
2
+ import { registerGetListComponentsTool } from './get-list-components.js';
3
+ import { registerGetMigrationGuideTool } from './get-migration-guide.js';
4
+ import { registerGetOverviewTool } from './get-overview.js';
5
+ export function registerAllTools(server) {
6
+ registerGetOverviewTool(server);
7
+ registerGetListComponentsTool(server);
8
+ registerGetComponentExampleTool(server);
9
+ registerGetMigrationGuideTool(server);
10
+ }
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,+BAA+B,EAAC,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAC,6BAA6B,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAC,6BAA6B,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAC,uBAAuB,EAAC,MAAM,mBAAmB,CAAC;AAE1D,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAC9C,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACxC,6BAA6B,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}