@adia-ai/a2ui-mcp 0.6.6 → 0.6.7

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/tools/zettel.ts DELETED
@@ -1,98 +0,0 @@
1
- /**
2
- * Zettel composition-inspection tools.
3
- *
4
- * Extracted from server.ts. Registers:
5
- * get_composition, resolve_composition, get_graph, zettel_stats, search_patterns
6
- */
7
-
8
- import { z } from 'zod';
9
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
10
-
11
- import {
12
- getComposition as getZettelComposition,
13
- getAllCompositions as getAllZettelCompositions,
14
- getGraph as getZettelGraph,
15
- searchAll as searchCompositions,
16
- } from '../../compose/strategies/zettel/composition-library.js';
17
- import {
18
- resolveComposition as resolveZettelComposition,
19
- templateToMessages as zettelTemplateToMessages,
20
- } from '../../compose/strategies/zettel/composer.js';
21
-
22
- export function registerZettelTools(server: McpServer): void {
23
- server.tool(
24
- 'search_patterns',
25
- `Search the composition library for reusable UI templates. Returns matching compositions with full A2UI component trees that can be used directly or adapted.
26
-
27
- Use this to find a starting point before generating from scratch. If a good composition exists, pass it to generate_ui with instant mode. If no composition matches, use generate_ui with thinking mode.
28
-
29
- Keyword search (§64 v0.4.6 migration: now backed by composition-library; the historical "pattern" library is retired).`,
30
- {
31
- query: z.string().describe('Search query (natural language)'),
32
- },
33
- async ({ query }) => {
34
- const results = searchCompositions(query);
35
- return { content: [{ type: 'text', text: JSON.stringify(results, null, 2) }] };
36
- }
37
- );
38
-
39
- server.tool(
40
- 'get_composition',
41
- 'Fetch a composition by name. Returns the flat A2UI template (compositions are pre-inlined; no $fragment refs). Zettel-only.',
42
- { name: z.string() },
43
- async ({ name }) => {
44
- const c = getZettelComposition(name);
45
- if (!c) return { content: [{ type: 'text', text: `Composition not found: ${name}` }], isError: true };
46
- return { content: [{ type: 'text', text: JSON.stringify(c, null, 2) }] };
47
- },
48
- );
49
-
50
- server.tool(
51
- 'resolve_composition',
52
- 'Return the flat A2UI template + updateComponents messages for a composition. Zettel-only. (Pre-inlined since §37 — `resolve` is now a defensive copy + strip pass.)',
53
- { name: z.string() },
54
- async ({ name }) => {
55
- const c = getZettelComposition(name);
56
- if (!c) return { content: [{ type: 'text', text: `Composition not found: ${name}` }], isError: true };
57
- const template = resolveZettelComposition(c);
58
- const messages = zettelTemplateToMessages(template);
59
- return {
60
- content: [{
61
- type: 'text',
62
- text: JSON.stringify({ template, messages }, null, 2),
63
- }],
64
- };
65
- },
66
- );
67
-
68
- server.tool(
69
- 'get_graph',
70
- 'Return the composition catalog. Zettel-only. (Backlinks to fragments retired in §37; only composition nodes remain.)',
71
- {},
72
- async () => ({ content: [{ type: 'text', text: JSON.stringify(getZettelGraph(), null, 2) }] }),
73
- );
74
-
75
- server.tool(
76
- 'zettel_stats',
77
- 'Zettel corpus stats — composition count + average node count. (Fragment stats retired in §37.)',
78
- {},
79
- async () => {
80
- const comps = getAllZettelCompositions();
81
- const totalNodes = comps.reduce((s, c) => {
82
- const comp = c as Record<string, unknown>;
83
- const tpl = comp['template'];
84
- return s + (Array.isArray(tpl) ? tpl.length : 0);
85
- }, 0);
86
- return {
87
- content: [{
88
- type: 'text',
89
- text: JSON.stringify({
90
- compositions: comps.length,
91
- avg_nodes_per_composition: comps.length ? Math.round(totalNodes / comps.length) : 0,
92
- total_nodes: totalNodes,
93
- }, null, 2),
94
- }],
95
- };
96
- },
97
- );
98
- }