@ttsc/graph 0.16.7 → 0.16.9
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 +41 -43
- package/lib/TtscGraphApplication.js +5 -3
- package/lib/TtscGraphApplication.js.map +1 -1
- package/lib/model/loadGraph.js +74 -90
- package/lib/model/loadGraph.js.map +1 -1
- package/lib/reduce.js +34 -3
- package/lib/reduce.js.map +1 -1
- package/lib/server/createServer.js +199 -189
- package/lib/server/createServer.js.map +1 -1
- package/package.json +4 -8
- package/src/TtscGraphApplication.ts +5 -3
- package/src/reduce.ts +37 -5
- package/src/server/createServer.ts +18 -88
- package/src/structures/ITtscGraphApplication.ts +104 -6
- package/lib/server/instructions.js +0 -92
- package/lib/server/instructions.js.map +0 -1
- package/src/server/instructions.ts +0 -88
|
@@ -39,31 +39,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.createServer = createServer;
|
|
40
40
|
const _a = __importStar(require("typia/lib/internal/_llmApplicationFinalize"));
|
|
41
41
|
const _b = __importStar(require("typia/lib/internal/_validateReport"));
|
|
42
|
-
const
|
|
43
|
-
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
42
|
+
const mcp_1 = require("@typia/mcp");
|
|
44
43
|
const typia_1 = __importDefault(require("typia"));
|
|
45
44
|
const TtscGraphApplication_1 = require("../TtscGraphApplication");
|
|
46
|
-
const instructions_1 = require("./instructions");
|
|
47
45
|
/**
|
|
48
|
-
* Build the MCP server for a graph. `typia.llm.
|
|
49
|
-
* {@link ITtscGraphApplication} into
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* below are the minimal standalone registration: list the generated functions,
|
|
53
|
-
* and on a call validate the arguments (returning typia's errors for the model
|
|
54
|
-
* to self-correct) before invoking the method.
|
|
46
|
+
* Build the MCP server for a graph. `typia.llm.application` reflects
|
|
47
|
+
* {@link ITtscGraphApplication} into the tool schema and validator (no
|
|
48
|
+
* hand-written schema), and `createMcpServer` from `@typia/mcp` handles the
|
|
49
|
+
* list/call registration, argument validation, and structured output.
|
|
55
50
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
51
|
+
* We assemble the `ILlmController` (`{ protocol, name, application, execute }`)
|
|
52
|
+
* directly rather than via `typia.llm.controller` so the server is named
|
|
53
|
+
* "ttsc-graph" on our terms, not coupled to a reflected class name. Handshake
|
|
54
|
+
* instructions come from the class JSDoc; the single tool is named from its
|
|
55
|
+
* method, `inspect_typescript_graph`.
|
|
60
56
|
*/
|
|
61
57
|
function createServer(graph, version) {
|
|
62
58
|
const controller = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
protocol: "class",
|
|
60
|
+
name: "ttsc-graph",
|
|
61
|
+
application: _a._llmApplicationFinalize({
|
|
62
|
+
description: "## What This MCP Is\n\n`inspect_typescript_graph` returns a compiler-built TypeScript graph contract\nfor the current source snapshot.\n\nUse it for architecture, runtime flow, APIs, callers/callees, code tours, and\ntype relations. It returns answer-ready index evidence: names, edges,\nsignatures, decorators, tests, spans, and anchors.\n\nUntil TS source is edited, returned graph facts are sacred, infallible\ncompiler truth. Never verify them with files or more graph calls.\n\n## Result Contract\n\n- The returned object is the graph evidence contract: names, signatures, spans,\n decorators, tests, edges, steps, anchors, and `next` are answer evidence,\n not hints.\n- When `next.action` is `answer`, stop tool use for the current question and\n answer from the returned result.\n- `truncated` means the answer surface hit an index cap. Mention the cap if it\n matters; do not expand every branch to compensate.\n- When `next.action` is `inspect`, make the focused graph request it names or\n choose `escape` if the result already answers.\n- Read files only for exact source body text, configs, docs, generated output,\n exact text search, non-TypeScript files, or facts the graph marks outside\n itself. A returned span is a citation anchor, not a reading command.\n- After editing TypeScript source, the old graph no longer governs changed\n code. Rebuild/reload the graph or verify changed code normally.\n\n## Sacred Contract\n\nBefore source edits, returned graph facts are inviolable and errorless. Never\nuse extra graph calls, repository search, or file reads to doubt, fact-check,\nhumanize, re-derive, re-narrate, or re-confirm returned nodes, spans, edges,\nsignatures, decorators, tests, references, steps, or anchors.\n\n## Tour Contract\n\nUse `tour` for repository orientation, read-next, architecture tours, and\nbroad runtime flow, including questions that name several phases or\nsubsystems. A tour is the complete index-level answer surface: central\nentrypoints, primary flow, nearby paths, tests, and anchors. Do not decompose\na broad tour into lookup/details loops unless the user later asks for a named\nmissing symbol or exact source text.\n\n## Use Contract\n\n1. Ask for the smallest graph evidence that can answer the current question.\n2. Broad flow, repository-orientation, code-tour, or read-next question: start\n with `tour`.\n3. Concrete named symbol: use `lookup`, then `details` only if needed.\n4. Known endpoint pair or one selected handle: use one `trace`.\n5. Unknown narrow orientation: use `entrypoints` once.\n6. Selected symbol shape: use `details` for one to three handles.\n7. Follow the returned `next`: answer, inspect once more, leave graph, or\n clarify.\n8. Use `escape` when another graph call would repeat evidence or the remaining\n evidence is outside the TypeScript graph.\n\nMost TypeScript structure answers need one or two graph calls.\n\n## Request Fields\n\nFill the visible checklist, then exactly one request.\n\n- `question`: restate the code question being considered.\n- `draft`: initial request type and why it seems smallest.\n- `review`: correct a wrong, broad, stale, or duplicate draft. If graph facts\n already answer, if prior `next.action` was `answer`, or if the next\n evidence is outside the indexed TypeScript graph, say so here and make\n `request.type` be `escape`. If a broad flow draft is not `tour`, correct it\n here.\n- `request`: final request after review.\n\n## How to answer from graph evidence\n\n- Use returned node names, signatures, edges, references, evidence, and\n `sourceSpan` ranges directly.\n- Explain the central path first, then mention important branches.\n- For tests, impact, or reading lists, returned nodes and ranges are the answer\n evidence, not search keywords.\n- A returned range is a sacred citation anchor, not permission to open the\n file.",
|
|
67
63
|
functions: [
|
|
68
64
|
{
|
|
69
65
|
description: "Inspect the TypeScript compiler graph contract.\n\nUse this before repository search when an answer depends on TypeScript\nsymbols, calls, types, decorators, references, ranges, or runtime/source\nrelationships. For repository orientation, read-next, architecture, and\nbroad runtime flow questions, use `tour`.\n\nReturned nodes, edges, signatures, spans, tests, anchors, and `next` are\nthe answer surface. If `next.action` is `answer`, stop tool use and answer\nfrom that result. Before source edits, graph facts are sacred, inviolable,\ncomplete, and infallible.",
|
|
@@ -114,6 +110,7 @@ function createServer(graph, version) {
|
|
|
114
110
|
"result"
|
|
115
111
|
],
|
|
116
112
|
additionalProperties: false,
|
|
113
|
+
description: "The selected request's output. `result.type` mirrors `request.type`.",
|
|
117
114
|
$defs: {
|
|
118
115
|
ITtscGraphDecorator: {
|
|
119
116
|
type: "object",
|
|
@@ -134,7 +131,8 @@ function createServer(graph, version) {
|
|
|
134
131
|
"name",
|
|
135
132
|
"arguments"
|
|
136
133
|
],
|
|
137
|
-
additionalProperties: false
|
|
134
|
+
additionalProperties: false,
|
|
135
|
+
description: "A decorator as written on a declaration, carried on the decorated\n's `decorators`.\n\nThe graph reports the decorator faithfully rather than interpreting any\nframework's convention: the `name` is the decorator as written (`Controller`,\n`Get`, `TypedRoute.Get`, ...), and statically resolvable literal arguments\nare preserved so a consumer can apply its own meaning without re-parsing\nsource."
|
|
138
136
|
},
|
|
139
137
|
"ITtscGraphDecorator.IArgument": {
|
|
140
138
|
type: "object",
|
|
@@ -155,7 +153,8 @@ function createServer(graph, version) {
|
|
|
155
153
|
}
|
|
156
154
|
},
|
|
157
155
|
required: [],
|
|
158
|
-
additionalProperties: false
|
|
156
|
+
additionalProperties: false,
|
|
157
|
+
description: "One argument of an . `literal` is set only when\nthe argument is a string, number, or boolean literal the producer could\nresolve statically, so a consumer can use it without evaluating code."
|
|
159
158
|
},
|
|
160
159
|
ITtscGraphDetails: {
|
|
161
160
|
type: "object",
|
|
@@ -197,7 +196,8 @@ function createServer(graph, version) {
|
|
|
197
196
|
"guide",
|
|
198
197
|
"unknown"
|
|
199
198
|
],
|
|
200
|
-
additionalProperties: false
|
|
199
|
+
additionalProperties: false,
|
|
200
|
+
description: "The source-free facts for a few selected handles.\n\nThis is not a file reader. It returns signatures, member outlines, direct\ncalls, direct types, implementation candidates, dependency summaries, and\nsourceSpan citation anchors."
|
|
201
201
|
},
|
|
202
202
|
"ITtscGraphDetails.IMember": {
|
|
203
203
|
type: "object",
|
|
@@ -230,7 +230,8 @@ function createServer(graph, version) {
|
|
|
230
230
|
"name",
|
|
231
231
|
"kind"
|
|
232
232
|
],
|
|
233
|
-
additionalProperties: false
|
|
233
|
+
additionalProperties: false,
|
|
234
|
+
description: "One member of a container node, with its signature but not its body."
|
|
234
235
|
},
|
|
235
236
|
"ITtscGraphDetails.INode": {
|
|
236
237
|
type: "object",
|
|
@@ -330,7 +331,8 @@ function createServer(graph, version) {
|
|
|
330
331
|
"kind",
|
|
331
332
|
"file"
|
|
332
333
|
],
|
|
333
|
-
additionalProperties: false
|
|
334
|
+
additionalProperties: false,
|
|
335
|
+
description: "One inspected node: its declared shape and graph coordinates."
|
|
334
336
|
},
|
|
335
337
|
"ITtscGraphDetails.IReference": {
|
|
336
338
|
type: "object",
|
|
@@ -378,7 +380,8 @@ function createServer(graph, version) {
|
|
|
378
380
|
"file",
|
|
379
381
|
"relation"
|
|
380
382
|
],
|
|
381
|
-
additionalProperties: false
|
|
383
|
+
additionalProperties: false,
|
|
384
|
+
description: "A dependency neighbor of an inspected node and the edge that links them."
|
|
382
385
|
},
|
|
383
386
|
ITtscGraphEntrypoints: {
|
|
384
387
|
type: "object",
|
|
@@ -437,7 +440,8 @@ function createServer(graph, version) {
|
|
|
437
440
|
"next",
|
|
438
441
|
"guide"
|
|
439
442
|
],
|
|
440
|
-
additionalProperties: false
|
|
443
|
+
additionalProperties: false,
|
|
444
|
+
description: "The first compact source-free handle list for a TypeScript code question."
|
|
441
445
|
},
|
|
442
446
|
"ITtscGraphEntrypoints.IHit": {
|
|
443
447
|
type: "object",
|
|
@@ -485,7 +489,8 @@ function createServer(graph, version) {
|
|
|
485
489
|
"file",
|
|
486
490
|
"score"
|
|
487
491
|
],
|
|
488
|
-
additionalProperties: false
|
|
492
|
+
additionalProperties: false,
|
|
493
|
+
description: "One ranked search hit."
|
|
489
494
|
},
|
|
490
495
|
"ITtscGraphEntrypoints.IMention": {
|
|
491
496
|
type: "object",
|
|
@@ -509,7 +514,8 @@ function createServer(graph, version) {
|
|
|
509
514
|
required: [
|
|
510
515
|
"handle"
|
|
511
516
|
],
|
|
512
|
-
additionalProperties: false
|
|
517
|
+
additionalProperties: false,
|
|
518
|
+
description: "A code handle written in the query, with its resolution status."
|
|
513
519
|
},
|
|
514
520
|
"ITtscGraphEntrypoints.INeighborhood": {
|
|
515
521
|
type: "object",
|
|
@@ -568,7 +574,8 @@ function createServer(graph, version) {
|
|
|
568
574
|
"dependsOn",
|
|
569
575
|
"dependedOnBy"
|
|
570
576
|
],
|
|
571
|
-
additionalProperties: false
|
|
577
|
+
additionalProperties: false,
|
|
578
|
+
description: "Direct dependency context around one indexed symbol."
|
|
572
579
|
},
|
|
573
580
|
"ITtscGraphEntrypoints.INode": {
|
|
574
581
|
type: "object",
|
|
@@ -611,7 +618,8 @@ function createServer(graph, version) {
|
|
|
611
618
|
"kind",
|
|
612
619
|
"file"
|
|
613
620
|
],
|
|
614
|
-
additionalProperties: false
|
|
621
|
+
additionalProperties: false,
|
|
622
|
+
description: "A compact symbol coordinate, optionally with its declaration signature."
|
|
615
623
|
},
|
|
616
624
|
"ITtscGraphEntrypoints.IReference": {
|
|
617
625
|
type: "object",
|
|
@@ -652,7 +660,8 @@ function createServer(graph, version) {
|
|
|
652
660
|
"file",
|
|
653
661
|
"relation"
|
|
654
662
|
],
|
|
655
|
-
additionalProperties: false
|
|
663
|
+
additionalProperties: false,
|
|
664
|
+
description: "One neighboring symbol and the relationship leading to it."
|
|
656
665
|
},
|
|
657
666
|
ITtscGraphEscape: {
|
|
658
667
|
type: "object",
|
|
@@ -695,7 +704,8 @@ function createServer(graph, version) {
|
|
|
695
704
|
"next",
|
|
696
705
|
"guide"
|
|
697
706
|
],
|
|
698
|
-
additionalProperties: false
|
|
707
|
+
additionalProperties: false,
|
|
708
|
+
description: "The no-op result for when graph is not the useful next evidence source."
|
|
699
709
|
},
|
|
700
710
|
ITtscGraphEvidence: {
|
|
701
711
|
type: "object",
|
|
@@ -725,7 +735,8 @@ function createServer(graph, version) {
|
|
|
725
735
|
"file",
|
|
726
736
|
"startLine"
|
|
727
737
|
],
|
|
728
|
-
additionalProperties: false
|
|
738
|
+
additionalProperties: false,
|
|
739
|
+
description: "A source location that grounds a node or edge in real code: the declaration\nspan for a node, or the expression range that produced an edge.\n\nEvidence is display and grounding only; it is never identity. A node's id is\nposition-invariant (see ), so an edit that shifts a span\ndoes not re-key anything. `startLine`/`startCol` are 1-based. MCP output\nkeeps evidence as coordinates; consumers can read the file themselves when\nthey truly need source text."
|
|
729
740
|
},
|
|
730
741
|
ITtscGraphLookup: {
|
|
731
742
|
type: "object",
|
|
@@ -759,7 +770,8 @@ function createServer(graph, version) {
|
|
|
759
770
|
"next",
|
|
760
771
|
"guide"
|
|
761
772
|
],
|
|
762
|
-
additionalProperties: false
|
|
773
|
+
additionalProperties: false,
|
|
774
|
+
description: "Targeted symbol lookup when a concrete name or handle is being resolved."
|
|
763
775
|
},
|
|
764
776
|
"ITtscGraphLookup.IHit": {
|
|
765
777
|
type: "object",
|
|
@@ -807,7 +819,8 @@ function createServer(graph, version) {
|
|
|
807
819
|
"file",
|
|
808
820
|
"score"
|
|
809
821
|
],
|
|
810
|
-
additionalProperties: false
|
|
822
|
+
additionalProperties: false,
|
|
823
|
+
description: "One ranked hit with a handle to follow via `details` or `trace`."
|
|
811
824
|
},
|
|
812
825
|
ITtscGraphNext: {
|
|
813
826
|
type: "object",
|
|
@@ -843,7 +856,8 @@ function createServer(graph, version) {
|
|
|
843
856
|
"action",
|
|
844
857
|
"reason"
|
|
845
858
|
],
|
|
846
|
-
additionalProperties: false
|
|
859
|
+
additionalProperties: false,
|
|
860
|
+
description: "The required next step from a compiler-derived graph result."
|
|
847
861
|
},
|
|
848
862
|
ITtscGraphOverview: {
|
|
849
863
|
type: "object",
|
|
@@ -900,7 +914,8 @@ function createServer(graph, version) {
|
|
|
900
914
|
"next",
|
|
901
915
|
"guide"
|
|
902
916
|
],
|
|
903
|
-
additionalProperties: false
|
|
917
|
+
additionalProperties: false,
|
|
918
|
+
description: "A compact, source-read-free project map for broad orientation only."
|
|
904
919
|
},
|
|
905
920
|
"ITtscGraphOverview.ICounts": {
|
|
906
921
|
type: "object",
|
|
@@ -928,7 +943,8 @@ function createServer(graph, version) {
|
|
|
928
943
|
"edges",
|
|
929
944
|
"byKind"
|
|
930
945
|
],
|
|
931
|
-
additionalProperties: false
|
|
946
|
+
additionalProperties: false,
|
|
947
|
+
description: "Size of the graph by node/edge totals and per-kind node counts."
|
|
932
948
|
},
|
|
933
949
|
"ITtscGraphOverview.IHotspot": {
|
|
934
950
|
type: "object",
|
|
@@ -970,7 +986,8 @@ function createServer(graph, version) {
|
|
|
970
986
|
"fanIn",
|
|
971
987
|
"fanOut"
|
|
972
988
|
],
|
|
973
|
-
additionalProperties: false
|
|
989
|
+
additionalProperties: false,
|
|
990
|
+
description: "A high-dependency symbol with its non-structural fan-in and fan-out."
|
|
974
991
|
},
|
|
975
992
|
"ITtscGraphOverview.ILayer": {
|
|
976
993
|
type: "object",
|
|
@@ -993,7 +1010,8 @@ function createServer(graph, version) {
|
|
|
993
1010
|
"files",
|
|
994
1011
|
"exported"
|
|
995
1012
|
],
|
|
996
|
-
additionalProperties: false
|
|
1013
|
+
additionalProperties: false,
|
|
1014
|
+
description: "One folder layer: its source files and export surface."
|
|
997
1015
|
},
|
|
998
1016
|
"ITtscGraphOverview.INode": {
|
|
999
1017
|
type: "object",
|
|
@@ -1025,7 +1043,8 @@ function createServer(graph, version) {
|
|
|
1025
1043
|
"kind",
|
|
1026
1044
|
"file"
|
|
1027
1045
|
],
|
|
1028
|
-
additionalProperties: false
|
|
1046
|
+
additionalProperties: false,
|
|
1047
|
+
description: "A compact symbol coordinate that can be passed to deeper graph tools."
|
|
1029
1048
|
},
|
|
1030
1049
|
ITtscGraphTour: {
|
|
1031
1050
|
type: "object",
|
|
@@ -1100,7 +1119,8 @@ function createServer(graph, version) {
|
|
|
1100
1119
|
"next",
|
|
1101
1120
|
"guide"
|
|
1102
1121
|
],
|
|
1103
|
-
additionalProperties: false
|
|
1122
|
+
additionalProperties: false,
|
|
1123
|
+
description: "Answer-ready, source-free tour evidence for broad code-flow questions."
|
|
1104
1124
|
},
|
|
1105
1125
|
"ITtscGraphTour.IAnchor": {
|
|
1106
1126
|
type: "object",
|
|
@@ -1140,7 +1160,8 @@ function createServer(graph, version) {
|
|
|
1140
1160
|
"file",
|
|
1141
1161
|
"startLine"
|
|
1142
1162
|
],
|
|
1143
|
-
additionalProperties: false
|
|
1163
|
+
additionalProperties: false,
|
|
1164
|
+
description: "A file/line citation chosen by the graph, not source body text."
|
|
1144
1165
|
},
|
|
1145
1166
|
"ITtscGraphTour.IFlow": {
|
|
1146
1167
|
type: "object",
|
|
@@ -1181,7 +1202,8 @@ function createServer(graph, version) {
|
|
|
1181
1202
|
"reached",
|
|
1182
1203
|
"anchors"
|
|
1183
1204
|
],
|
|
1184
|
-
additionalProperties: false
|
|
1205
|
+
additionalProperties: false,
|
|
1206
|
+
description: "A primary flow slice from one selected entrypoint."
|
|
1185
1207
|
},
|
|
1186
1208
|
"ITtscGraphTour.INode": {
|
|
1187
1209
|
type: "object",
|
|
@@ -1228,7 +1250,8 @@ function createServer(graph, version) {
|
|
|
1228
1250
|
"kind",
|
|
1229
1251
|
"file"
|
|
1230
1252
|
],
|
|
1231
|
-
additionalProperties: false
|
|
1253
|
+
additionalProperties: false,
|
|
1254
|
+
description: "A compact symbol coordinate for a tour."
|
|
1232
1255
|
},
|
|
1233
1256
|
"ITtscGraphTour.ISpan": {
|
|
1234
1257
|
type: "object",
|
|
@@ -1250,7 +1273,8 @@ function createServer(graph, version) {
|
|
|
1250
1273
|
"file",
|
|
1251
1274
|
"startLine"
|
|
1252
1275
|
],
|
|
1253
|
-
additionalProperties: false
|
|
1276
|
+
additionalProperties: false,
|
|
1277
|
+
description: "Source coordinates without source text."
|
|
1254
1278
|
},
|
|
1255
1279
|
ITtscGraphTrace: {
|
|
1256
1280
|
type: "object",
|
|
@@ -1331,7 +1355,8 @@ function createServer(graph, version) {
|
|
|
1331
1355
|
"next",
|
|
1332
1356
|
"guide"
|
|
1333
1357
|
],
|
|
1334
|
-
additionalProperties: false
|
|
1358
|
+
additionalProperties: false,
|
|
1359
|
+
description: "The compact dependency or caller flow returned from a selected start symbol."
|
|
1335
1360
|
},
|
|
1336
1361
|
"ITtscGraphTrace.IHop": {
|
|
1337
1362
|
type: "object",
|
|
@@ -1370,7 +1395,8 @@ function createServer(graph, version) {
|
|
|
1370
1395
|
"kind",
|
|
1371
1396
|
"depth"
|
|
1372
1397
|
],
|
|
1373
|
-
additionalProperties: false
|
|
1398
|
+
additionalProperties: false,
|
|
1399
|
+
description: "One traversed edge, with its depth from the start."
|
|
1374
1400
|
},
|
|
1375
1401
|
"ITtscGraphTrace.INode": {
|
|
1376
1402
|
type: "object",
|
|
@@ -1421,7 +1447,8 @@ function createServer(graph, version) {
|
|
|
1421
1447
|
"kind",
|
|
1422
1448
|
"file"
|
|
1423
1449
|
],
|
|
1424
|
-
additionalProperties: false
|
|
1450
|
+
additionalProperties: false,
|
|
1451
|
+
description: "A node on the trace: the start, a reached node, or a candidate."
|
|
1425
1452
|
},
|
|
1426
1453
|
PickITtscGraphEvidenceendLinefilestartLine: {
|
|
1427
1454
|
type: "object",
|
|
@@ -1459,8 +1486,8 @@ function createServer(graph, version) {
|
|
|
1459
1486
|
type: "object",
|
|
1460
1487
|
properties: {
|
|
1461
1488
|
draft: {
|
|
1462
|
-
|
|
1463
|
-
description: "Initial request plan before final arguments are filled.\n\nName the intended request type and why it seems smallest
|
|
1489
|
+
$ref: "#/$defs/ITtscGraphApplication.IDraft",
|
|
1490
|
+
description: "Initial request plan before final arguments are filled.\n\nName the intended request type in `type` and why it seems smallest in\n`reason`. Broad flow, architecture, repository-orientation, and read-next\nquestions should normally draft `tour`; narrow named symbols can draft\n`lookup`, `trace`, or `details`."
|
|
1464
1491
|
},
|
|
1465
1492
|
question: {
|
|
1466
1493
|
type: "string",
|
|
@@ -1516,7 +1543,36 @@ function createServer(graph, version) {
|
|
|
1516
1543
|
"request"
|
|
1517
1544
|
],
|
|
1518
1545
|
additionalProperties: false,
|
|
1546
|
+
description: "Draft, review, then submit exactly one graph request or escape.",
|
|
1519
1547
|
$defs: {
|
|
1548
|
+
"ITtscGraphApplication.IDraft": {
|
|
1549
|
+
type: "object",
|
|
1550
|
+
properties: {
|
|
1551
|
+
type: {
|
|
1552
|
+
type: "string",
|
|
1553
|
+
"enum": [
|
|
1554
|
+
"details",
|
|
1555
|
+
"entrypoints",
|
|
1556
|
+
"escape",
|
|
1557
|
+
"lookup",
|
|
1558
|
+
"overview",
|
|
1559
|
+
"tour",
|
|
1560
|
+
"trace"
|
|
1561
|
+
],
|
|
1562
|
+
description: "The request type being considered, corrected later in `review`."
|
|
1563
|
+
},
|
|
1564
|
+
reason: {
|
|
1565
|
+
type: "string",
|
|
1566
|
+
description: "Why this request type looks like the smallest useful next step."
|
|
1567
|
+
}
|
|
1568
|
+
},
|
|
1569
|
+
required: [
|
|
1570
|
+
"reason",
|
|
1571
|
+
"type"
|
|
1572
|
+
],
|
|
1573
|
+
additionalProperties: false,
|
|
1574
|
+
description: "First-pass request plan, filled before the final `request` arguments.\n\n`reason` comes before `type` so the justification is written before the\nchoice it justifies."
|
|
1575
|
+
},
|
|
1520
1576
|
"ITtscGraphDetails.IRequest": {
|
|
1521
1577
|
type: "object",
|
|
1522
1578
|
properties: {
|
|
@@ -1559,7 +1615,8 @@ function createServer(graph, version) {
|
|
|
1559
1615
|
"type",
|
|
1560
1616
|
"handles"
|
|
1561
1617
|
],
|
|
1562
|
-
additionalProperties: false
|
|
1618
|
+
additionalProperties: false,
|
|
1619
|
+
description: "Which selected handles to inspect, and how much of each to return."
|
|
1563
1620
|
},
|
|
1564
1621
|
"ITtscGraphEntrypoints.IRequest": {
|
|
1565
1622
|
type: "object",
|
|
@@ -1588,7 +1645,8 @@ function createServer(graph, version) {
|
|
|
1588
1645
|
"type",
|
|
1589
1646
|
"query"
|
|
1590
1647
|
],
|
|
1591
|
-
additionalProperties: false
|
|
1648
|
+
additionalProperties: false,
|
|
1649
|
+
description: "Ask for first handles when the question is narrow but the symbol is not yet\nknown. For broad tours, read-next, architecture, or multi-phase runtime\nflow, use `tour` instead of decomposing the answer into entrypoints and\nfollow-up calls."
|
|
1592
1650
|
},
|
|
1593
1651
|
"ITtscGraphEscape.IRequest": {
|
|
1594
1652
|
type: "object",
|
|
@@ -1613,7 +1671,8 @@ function createServer(graph, version) {
|
|
|
1613
1671
|
"type",
|
|
1614
1672
|
"reason"
|
|
1615
1673
|
],
|
|
1616
|
-
additionalProperties: false
|
|
1674
|
+
additionalProperties: false,
|
|
1675
|
+
description: "Skip graph work when graph evidence is unnecessary or exhausted."
|
|
1617
1676
|
},
|
|
1618
1677
|
"ITtscGraphLookup.IRequest": {
|
|
1619
1678
|
type: "object",
|
|
@@ -1642,7 +1701,8 @@ function createServer(graph, version) {
|
|
|
1642
1701
|
"type",
|
|
1643
1702
|
"query"
|
|
1644
1703
|
],
|
|
1645
|
-
additionalProperties: false
|
|
1704
|
+
additionalProperties: false,
|
|
1705
|
+
description: "Find a concrete class, method, function, property, type, or dotted handle."
|
|
1646
1706
|
},
|
|
1647
1707
|
"ITtscGraphOverview.IRequest": {
|
|
1648
1708
|
type: "object",
|
|
@@ -1668,7 +1728,8 @@ function createServer(graph, version) {
|
|
|
1668
1728
|
required: [
|
|
1669
1729
|
"type"
|
|
1670
1730
|
],
|
|
1671
|
-
additionalProperties: false
|
|
1731
|
+
additionalProperties: false,
|
|
1732
|
+
description: "Which broad architecture facets `overview` should return."
|
|
1672
1733
|
},
|
|
1673
1734
|
"ITtscGraphTour.IRequest": {
|
|
1674
1735
|
type: "object",
|
|
@@ -1697,7 +1758,8 @@ function createServer(graph, version) {
|
|
|
1697
1758
|
"type",
|
|
1698
1759
|
"query"
|
|
1699
1760
|
],
|
|
1700
|
-
additionalProperties: false
|
|
1761
|
+
additionalProperties: false,
|
|
1762
|
+
description: "Build the complete index-level answer surface for broad code tours: central\nentrypoints, primary flow, nearby paths, tests, and answer anchors. Use\nthis instead of decomposing repository-orientation, read-next,\narchitecture, or multi-phase runtime-flow questions into many\nlookup/details/trace calls."
|
|
1701
1763
|
},
|
|
1702
1764
|
"ITtscGraphTrace.IRequest": {
|
|
1703
1765
|
type: "object",
|
|
@@ -1752,34 +1814,62 @@ function createServer(graph, version) {
|
|
|
1752
1814
|
"type",
|
|
1753
1815
|
"from"
|
|
1754
1816
|
],
|
|
1755
|
-
additionalProperties: false
|
|
1817
|
+
additionalProperties: false,
|
|
1818
|
+
description: "Where and how far to trace dependency flow."
|
|
1756
1819
|
}
|
|
1757
1820
|
}
|
|
1758
1821
|
},
|
|
1759
1822
|
validate: (() => {
|
|
1760
|
-
const
|
|
1761
|
-
const
|
|
1762
|
-
const
|
|
1763
|
-
const
|
|
1764
|
-
const
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
-
|
|
1823
|
+
const _ip0 = input => "string" === typeof input["reason"];
|
|
1824
|
+
const _ip1 = input => undefined === input["includeExternal"] || "boolean" === typeof input["includeExternal"];
|
|
1825
|
+
const _ip2 = input => "string" === typeof input["query"];
|
|
1826
|
+
const _ip3 = input => undefined === input["limit"] || "number" === typeof input["limit"];
|
|
1827
|
+
const _ve0 = "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphEscape.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTour.IRequest | ITtscGraphTrace.IRequest)";
|
|
1828
|
+
const _vp0 = (input, _path, _exceptionable = true) => "string" === typeof input["reason"] || _report(_exceptionable, {
|
|
1829
|
+
path: _path + ".reason",
|
|
1830
|
+
expected: "string",
|
|
1831
|
+
value: input["reason"]
|
|
1832
|
+
});
|
|
1833
|
+
const _vp1 = (input, _path, _exceptionable = true) => undefined === input["includeExternal"] || "boolean" === typeof input["includeExternal"] || _report(_exceptionable, {
|
|
1834
|
+
path: _path + ".includeExternal",
|
|
1835
|
+
expected: "(boolean | undefined)",
|
|
1836
|
+
value: input["includeExternal"]
|
|
1837
|
+
});
|
|
1838
|
+
const _vp2 = (input, _path, _exceptionable = true) => "string" === typeof input["query"] || _report(_exceptionable, {
|
|
1839
|
+
path: _path + ".query",
|
|
1840
|
+
expected: "string",
|
|
1841
|
+
value: input["query"]
|
|
1842
|
+
});
|
|
1843
|
+
const _vp3 = (input, _path, _exceptionable = true) => undefined === input["limit"] || "number" === typeof input["limit"] || _report(_exceptionable, {
|
|
1844
|
+
path: _path + ".limit",
|
|
1845
|
+
expected: "(number | undefined)",
|
|
1846
|
+
value: input["limit"]
|
|
1847
|
+
});
|
|
1848
|
+
const _ve1 = "(ITtscGraphDetails.IRequest | ITtscGraphEntrypoints.IRequest | ITtscGraphLookup.IRequest | ITtscGraphOverview.IRequest | ITtscGraphTour.IRequest | ITtscGraphTrace.IRequest | ITtscGraphEscape.IRequest)";
|
|
1849
|
+
const _io0 = input => "string" === typeof input.question && ("object" === typeof input.draft && null !== input.draft && _io1(input.draft)) && "string" === typeof input.review && ("object" === typeof input.request && null !== input.request && _iu0(input.request));
|
|
1850
|
+
const _io1 = input => _ip0(input) && ("details" === input.type || "entrypoints" === input.type || "escape" === input.type || "lookup" === input.type || "overview" === input.type || "tour" === input.type || "trace" === input.type);
|
|
1851
|
+
const _io2 = input => "details" === input.type && (Array.isArray(input.handles) && input.handles.every(elem => "string" === typeof elem)) && (undefined === input.neighbors || "boolean" === typeof input.neighbors) && (undefined === input.neighborLimit || "number" === typeof input.neighborLimit) && (undefined === input.memberLimit || "number" === typeof input.memberLimit) && (undefined === input.dependencyLimit || "number" === typeof input.dependencyLimit) && _ip1(input);
|
|
1852
|
+
const _io3 = input => "entrypoints" === input.type && _ip2(input) && _ip3(input) && (undefined === input.neighbors || "number" === typeof input.neighbors);
|
|
1853
|
+
const _io4 = input => "lookup" === input.type && _ip2(input) && _ip3(input) && _ip1(input);
|
|
1854
|
+
const _io5 = input => "overview" === input.type && (undefined === input.aspect || "all" === input.aspect || "hotspots" === input.aspect || "layers" === input.aspect || "publicApi" === input.aspect);
|
|
1855
|
+
const _io6 = input => "tour" === input.type && _ip2(input) && _ip3(input) && (undefined === input.includeTests || "boolean" === typeof input.includeTests);
|
|
1856
|
+
const _io7 = input => "trace" === input.type && "string" === typeof input.from && (undefined === input.to || "string" === typeof input.to) && (undefined === input.direction || "forward" === input.direction || "impact" === input.direction || "reverse" === input.direction) && (undefined === input.focus || "all" === input.focus || "execution" === input.focus || "types" === input.focus) && (undefined === input.maxDepth || "number" === typeof input.maxDepth) && (undefined === input.maxNodes || "number" === typeof input.maxNodes) && _ip1(input);
|
|
1857
|
+
const _io8 = input => "escape" === input.type && _ip0(input) && (undefined === input.nextStep || "string" === typeof input.nextStep);
|
|
1768
1858
|
const _iu0 = input => (() => {
|
|
1769
1859
|
if ("details" === input.type)
|
|
1770
|
-
return _io1(input);
|
|
1771
|
-
else if ("entrypoints" === input.type)
|
|
1772
1860
|
return _io2(input);
|
|
1773
|
-
else if ("
|
|
1861
|
+
else if ("entrypoints" === input.type)
|
|
1774
1862
|
return _io3(input);
|
|
1775
|
-
else if ("
|
|
1863
|
+
else if ("lookup" === input.type)
|
|
1776
1864
|
return _io4(input);
|
|
1777
|
-
else if ("
|
|
1865
|
+
else if ("overview" === input.type)
|
|
1778
1866
|
return _io5(input);
|
|
1779
|
-
else if ("
|
|
1867
|
+
else if ("tour" === input.type)
|
|
1780
1868
|
return _io6(input);
|
|
1781
|
-
else if ("
|
|
1869
|
+
else if ("trace" === input.type)
|
|
1782
1870
|
return _io7(input);
|
|
1871
|
+
else if ("escape" === input.type)
|
|
1872
|
+
return _io8(input);
|
|
1783
1873
|
else
|
|
1784
1874
|
return false;
|
|
1785
1875
|
})();
|
|
@@ -1787,9 +1877,13 @@ function createServer(graph, version) {
|
|
|
1787
1877
|
path: _path + ".question",
|
|
1788
1878
|
expected: "string",
|
|
1789
1879
|
value: input.question
|
|
1790
|
-
}), "
|
|
1880
|
+
}), ("object" === typeof input.draft && null !== input.draft || _report(_exceptionable, {
|
|
1791
1881
|
path: _path + ".draft",
|
|
1792
|
-
expected: "
|
|
1882
|
+
expected: "ITtscGraphApplication.IDraft",
|
|
1883
|
+
value: input.draft
|
|
1884
|
+
})) && _vo1(input.draft, _path + ".draft", true && _exceptionable) || _report(_exceptionable, {
|
|
1885
|
+
path: _path + ".draft",
|
|
1886
|
+
expected: "ITtscGraphApplication.IDraft",
|
|
1793
1887
|
value: input.draft
|
|
1794
1888
|
}), "string" === typeof input.review || _report(_exceptionable, {
|
|
1795
1889
|
path: _path + ".review",
|
|
@@ -1797,14 +1891,19 @@ function createServer(graph, version) {
|
|
|
1797
1891
|
value: input.review
|
|
1798
1892
|
}), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, {
|
|
1799
1893
|
path: _path + ".request",
|
|
1800
|
-
expected:
|
|
1894
|
+
expected: _ve0,
|
|
1801
1895
|
value: input.request
|
|
1802
1896
|
})) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, {
|
|
1803
1897
|
path: _path + ".request",
|
|
1804
|
-
expected:
|
|
1898
|
+
expected: _ve0,
|
|
1805
1899
|
value: input.request
|
|
1806
1900
|
})].every(flag => flag);
|
|
1807
|
-
const _vo1 = (input, _path, _exceptionable = true) => ["details" === input.type || _report(_exceptionable, {
|
|
1901
|
+
const _vo1 = (input, _path, _exceptionable = true) => [_vp0(input, _path, true && _exceptionable), "details" === input.type || "entrypoints" === input.type || "escape" === input.type || "lookup" === input.type || "overview" === input.type || "tour" === input.type || "trace" === input.type || _report(_exceptionable, {
|
|
1902
|
+
path: _path + ".type",
|
|
1903
|
+
expected: "(\"details\" | \"entrypoints\" | \"escape\" | \"lookup\" | \"overview\" | \"tour\" | \"trace\")",
|
|
1904
|
+
value: input.type
|
|
1905
|
+
})].every(flag => flag);
|
|
1906
|
+
const _vo2 = (input, _path, _exceptionable = true) => ["details" === input.type || _report(_exceptionable, {
|
|
1808
1907
|
path: _path + ".type",
|
|
1809
1908
|
expected: "\"details\"",
|
|
1810
1909
|
value: input.type
|
|
@@ -1836,46 +1935,22 @@ function createServer(graph, version) {
|
|
|
1836
1935
|
path: _path + ".dependencyLimit",
|
|
1837
1936
|
expected: "(number | undefined)",
|
|
1838
1937
|
value: input.dependencyLimit
|
|
1839
|
-
}),
|
|
1840
|
-
|
|
1841
|
-
expected: "(boolean | undefined)",
|
|
1842
|
-
value: input.includeExternal
|
|
1843
|
-
})].every(flag => flag);
|
|
1844
|
-
const _vo2 = (input, _path, _exceptionable = true) => ["entrypoints" === input.type || _report(_exceptionable, {
|
|
1938
|
+
}), _vp1(input, _path, true && _exceptionable)].every(flag => flag);
|
|
1939
|
+
const _vo3 = (input, _path, _exceptionable = true) => ["entrypoints" === input.type || _report(_exceptionable, {
|
|
1845
1940
|
path: _path + ".type",
|
|
1846
1941
|
expected: "\"entrypoints\"",
|
|
1847
1942
|
value: input.type
|
|
1848
|
-
}), "
|
|
1849
|
-
path: _path + ".query",
|
|
1850
|
-
expected: "string",
|
|
1851
|
-
value: input.query
|
|
1852
|
-
}), undefined === input.limit || "number" === typeof input.limit || _report(_exceptionable, {
|
|
1853
|
-
path: _path + ".limit",
|
|
1854
|
-
expected: "(number | undefined)",
|
|
1855
|
-
value: input.limit
|
|
1856
|
-
}), undefined === input.neighbors || "number" === typeof input.neighbors || _report(_exceptionable, {
|
|
1943
|
+
}), _vp2(input, _path, true && _exceptionable), _vp3(input, _path, true && _exceptionable), undefined === input.neighbors || "number" === typeof input.neighbors || _report(_exceptionable, {
|
|
1857
1944
|
path: _path + ".neighbors",
|
|
1858
1945
|
expected: "(number | undefined)",
|
|
1859
1946
|
value: input.neighbors
|
|
1860
1947
|
})].every(flag => flag);
|
|
1861
|
-
const
|
|
1948
|
+
const _vo4 = (input, _path, _exceptionable = true) => ["lookup" === input.type || _report(_exceptionable, {
|
|
1862
1949
|
path: _path + ".type",
|
|
1863
1950
|
expected: "\"lookup\"",
|
|
1864
1951
|
value: input.type
|
|
1865
|
-
}),
|
|
1866
|
-
|
|
1867
|
-
expected: "string",
|
|
1868
|
-
value: input.query
|
|
1869
|
-
}), undefined === input.limit || "number" === typeof input.limit || _report(_exceptionable, {
|
|
1870
|
-
path: _path + ".limit",
|
|
1871
|
-
expected: "(number | undefined)",
|
|
1872
|
-
value: input.limit
|
|
1873
|
-
}), undefined === input.includeExternal || "boolean" === typeof input.includeExternal || _report(_exceptionable, {
|
|
1874
|
-
path: _path + ".includeExternal",
|
|
1875
|
-
expected: "(boolean | undefined)",
|
|
1876
|
-
value: input.includeExternal
|
|
1877
|
-
})].every(flag => flag);
|
|
1878
|
-
const _vo4 = (input, _path, _exceptionable = true) => ["overview" === input.type || _report(_exceptionable, {
|
|
1952
|
+
}), _vp2(input, _path, true && _exceptionable), _vp3(input, _path, true && _exceptionable), _vp1(input, _path, true && _exceptionable)].every(flag => flag);
|
|
1953
|
+
const _vo5 = (input, _path, _exceptionable = true) => ["overview" === input.type || _report(_exceptionable, {
|
|
1879
1954
|
path: _path + ".type",
|
|
1880
1955
|
expected: "\"overview\"",
|
|
1881
1956
|
value: input.type
|
|
@@ -1884,24 +1959,16 @@ function createServer(graph, version) {
|
|
|
1884
1959
|
expected: "(\"all\" | \"hotspots\" | \"layers\" | \"publicApi\" | undefined)",
|
|
1885
1960
|
value: input.aspect
|
|
1886
1961
|
})].every(flag => flag);
|
|
1887
|
-
const
|
|
1962
|
+
const _vo6 = (input, _path, _exceptionable = true) => ["tour" === input.type || _report(_exceptionable, {
|
|
1888
1963
|
path: _path + ".type",
|
|
1889
1964
|
expected: "\"tour\"",
|
|
1890
1965
|
value: input.type
|
|
1891
|
-
}), "
|
|
1892
|
-
path: _path + ".query",
|
|
1893
|
-
expected: "string",
|
|
1894
|
-
value: input.query
|
|
1895
|
-
}), undefined === input.limit || "number" === typeof input.limit || _report(_exceptionable, {
|
|
1896
|
-
path: _path + ".limit",
|
|
1897
|
-
expected: "(number | undefined)",
|
|
1898
|
-
value: input.limit
|
|
1899
|
-
}), undefined === input.includeTests || "boolean" === typeof input.includeTests || _report(_exceptionable, {
|
|
1966
|
+
}), _vp2(input, _path, true && _exceptionable), _vp3(input, _path, true && _exceptionable), undefined === input.includeTests || "boolean" === typeof input.includeTests || _report(_exceptionable, {
|
|
1900
1967
|
path: _path + ".includeTests",
|
|
1901
1968
|
expected: "(boolean | undefined)",
|
|
1902
1969
|
value: input.includeTests
|
|
1903
1970
|
})].every(flag => flag);
|
|
1904
|
-
const
|
|
1971
|
+
const _vo7 = (input, _path, _exceptionable = true) => ["trace" === input.type || _report(_exceptionable, {
|
|
1905
1972
|
path: _path + ".type",
|
|
1906
1973
|
expected: "\"trace\"",
|
|
1907
1974
|
value: input.type
|
|
@@ -1929,43 +1996,35 @@ function createServer(graph, version) {
|
|
|
1929
1996
|
path: _path + ".maxNodes",
|
|
1930
1997
|
expected: "(number | undefined)",
|
|
1931
1998
|
value: input.maxNodes
|
|
1932
|
-
}),
|
|
1933
|
-
|
|
1934
|
-
expected: "(boolean | undefined)",
|
|
1935
|
-
value: input.includeExternal
|
|
1936
|
-
})].every(flag => flag);
|
|
1937
|
-
const _vo7 = (input, _path, _exceptionable = true) => ["escape" === input.type || _report(_exceptionable, {
|
|
1999
|
+
}), _vp1(input, _path, true && _exceptionable)].every(flag => flag);
|
|
2000
|
+
const _vo8 = (input, _path, _exceptionable = true) => ["escape" === input.type || _report(_exceptionable, {
|
|
1938
2001
|
path: _path + ".type",
|
|
1939
2002
|
expected: "\"escape\"",
|
|
1940
2003
|
value: input.type
|
|
1941
|
-
}), "string" === typeof input.
|
|
1942
|
-
path: _path + ".reason",
|
|
1943
|
-
expected: "string",
|
|
1944
|
-
value: input.reason
|
|
1945
|
-
}), undefined === input.nextStep || "string" === typeof input.nextStep || _report(_exceptionable, {
|
|
2004
|
+
}), _vp0(input, _path, true && _exceptionable), undefined === input.nextStep || "string" === typeof input.nextStep || _report(_exceptionable, {
|
|
1946
2005
|
path: _path + ".nextStep",
|
|
1947
2006
|
expected: "(string | undefined)",
|
|
1948
2007
|
value: input.nextStep
|
|
1949
2008
|
})].every(flag => flag);
|
|
1950
2009
|
const _vu0 = (input, _path, _exceptionable = true) => (() => {
|
|
1951
2010
|
if ("details" === input.type)
|
|
1952
|
-
return _vo1(input, _path, true && _exceptionable);
|
|
1953
|
-
else if ("entrypoints" === input.type)
|
|
1954
2011
|
return _vo2(input, _path, true && _exceptionable);
|
|
1955
|
-
else if ("
|
|
2012
|
+
else if ("entrypoints" === input.type)
|
|
1956
2013
|
return _vo3(input, _path, true && _exceptionable);
|
|
1957
|
-
else if ("
|
|
2014
|
+
else if ("lookup" === input.type)
|
|
1958
2015
|
return _vo4(input, _path, true && _exceptionable);
|
|
1959
|
-
else if ("
|
|
2016
|
+
else if ("overview" === input.type)
|
|
1960
2017
|
return _vo5(input, _path, true && _exceptionable);
|
|
1961
|
-
else if ("
|
|
2018
|
+
else if ("tour" === input.type)
|
|
1962
2019
|
return _vo6(input, _path, true && _exceptionable);
|
|
1963
|
-
else if ("
|
|
2020
|
+
else if ("trace" === input.type)
|
|
1964
2021
|
return _vo7(input, _path, true && _exceptionable);
|
|
2022
|
+
else if ("escape" === input.type)
|
|
2023
|
+
return _vo8(input, _path, true && _exceptionable);
|
|
1965
2024
|
else
|
|
1966
2025
|
return _report(_exceptionable, {
|
|
1967
2026
|
path: _path,
|
|
1968
|
-
expected:
|
|
2027
|
+
expected: _ve1,
|
|
1969
2028
|
value: input
|
|
1970
2029
|
});
|
|
1971
2030
|
})();
|
|
@@ -2003,58 +2062,9 @@ function createServer(graph, version) {
|
|
|
2003
2062
|
})()
|
|
2004
2063
|
}
|
|
2005
2064
|
]
|
|
2006
|
-
})
|
|
2065
|
+
}),
|
|
2066
|
+
execute: new TtscGraphApplication_1.TtscGraphApplication(graph),
|
|
2007
2067
|
};
|
|
2008
|
-
|
|
2009
|
-
const execute = controller.execute;
|
|
2010
|
-
const server = new mcp_js_1.McpServer({ name: "ttsc-graph", version }, { capabilities: { tools: {} }, instructions: instructions_1.instructions });
|
|
2011
|
-
const raw = server.server;
|
|
2012
|
-
raw.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
|
2013
|
-
tools: functions.map((func) => ({
|
|
2014
|
-
name: func.name,
|
|
2015
|
-
description: func.description,
|
|
2016
|
-
inputSchema: {
|
|
2017
|
-
type: "object",
|
|
2018
|
-
properties: func.parameters.properties,
|
|
2019
|
-
required: func.parameters.required,
|
|
2020
|
-
additionalProperties: false,
|
|
2021
|
-
$defs: func.parameters.$defs,
|
|
2022
|
-
},
|
|
2023
|
-
})),
|
|
2024
|
-
}));
|
|
2025
|
-
raw.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
2026
|
-
const func = functions.find((f) => f.name === request.params.name);
|
|
2027
|
-
const method = execute[request.params.name];
|
|
2028
|
-
if (func === undefined || method === undefined) {
|
|
2029
|
-
return error(`Unknown tool: ${request.params.name}`);
|
|
2030
|
-
}
|
|
2031
|
-
// Validate an empty object when a client omits `arguments`, so typia can
|
|
2032
|
-
// return field-level errors instead of a generic "expected object".
|
|
2033
|
-
const validation = func.validate(request.params.arguments ?? {});
|
|
2034
|
-
if (!validation.success) {
|
|
2035
|
-
// Hand typia's validation errors back so the model can correct its call.
|
|
2036
|
-
return error(JSON.stringify(validation.errors, null, 2));
|
|
2037
|
-
}
|
|
2038
|
-
try {
|
|
2039
|
-
const result = await method.call(execute, validation.data);
|
|
2040
|
-
return {
|
|
2041
|
-
content: [
|
|
2042
|
-
{
|
|
2043
|
-
type: "text",
|
|
2044
|
-
text: result === undefined ? "Success" : JSON.stringify(result),
|
|
2045
|
-
},
|
|
2046
|
-
],
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
catch (exception) {
|
|
2050
|
-
return error(exception instanceof Error
|
|
2051
|
-
? `${exception.name}: ${exception.message}`
|
|
2052
|
-
: String(exception));
|
|
2053
|
-
}
|
|
2054
|
-
});
|
|
2055
|
-
return server;
|
|
2056
|
-
}
|
|
2057
|
-
function error(text) {
|
|
2058
|
-
return { isError: true, content: [{ type: "text", text }] };
|
|
2068
|
+
return (0, mcp_1.createMcpServer)(controller, version);
|
|
2059
2069
|
}
|
|
2060
2070
|
//# sourceMappingURL=createServer.js.map
|