@pikku/inspector 0.9.5 → 0.9.6-next.0
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/CHANGELOG.md +8 -0
- package/dist/{add-channel.d.ts → add/add-channel.d.ts} +2 -2
- package/dist/{add-channel.js → add/add-channel.js} +12 -5
- package/dist/add/add-cli.d.ts +5 -0
- package/dist/add/add-cli.js +461 -0
- package/dist/{add-file-extends-core-type.d.ts → add/add-file-extends-core-type.d.ts} +2 -2
- package/dist/{add-file-extends-core-type.js → add/add-file-extends-core-type.js} +17 -5
- package/dist/{add-file-with-config.d.ts → add/add-file-with-config.d.ts} +1 -1
- package/dist/{add-file-with-config.js → add/add-file-with-config.js} +1 -1
- package/dist/{add-file-with-factory.d.ts → add/add-file-with-factory.d.ts} +1 -1
- package/dist/{add-file-with-factory.js → add/add-file-with-factory.js} +4 -4
- package/dist/add/add-functions.d.ts +6 -0
- package/dist/{add-functions.js → add/add-functions.js} +25 -5
- package/dist/{add-http-route.d.ts → add/add-http-route.d.ts} +2 -3
- package/dist/{add-http-route.js → add/add-http-route.js} +10 -4
- package/dist/add/add-mcp-prompt.d.ts +2 -0
- package/dist/{add-mcp-prompt.js → add/add-mcp-prompt.js} +10 -4
- package/dist/add/add-mcp-resource.d.ts +2 -0
- package/dist/{add-mcp-resource.js → add/add-mcp-resource.js} +10 -4
- package/dist/add/add-mcp-tool.d.ts +2 -0
- package/dist/{add-mcp-tool.js → add/add-mcp-tool.js} +10 -4
- package/dist/add/add-middleware.d.ts +5 -0
- package/dist/add/add-middleware.js +251 -0
- package/dist/add/add-permission.d.ts +6 -0
- package/dist/{add-permission.js → add/add-permission.js} +4 -3
- package/dist/add/add-queue-worker.d.ts +2 -0
- package/dist/{add-queue-worker.js → add/add-queue-worker.js} +10 -4
- package/dist/{add-rpc-invocations.d.ts → add/add-rpc-invocations.d.ts} +1 -1
- package/dist/add/add-schedule.d.ts +2 -0
- package/dist/{add-schedule.js → add/add-schedule.js} +10 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/inspector.d.ts +2 -3
- package/dist/inspector.js +19 -8
- package/dist/types.d.ts +79 -0
- package/dist/{utils.d.ts → utils/extract-function-name.d.ts} +7 -15
- package/dist/{utils.js → utils/extract-function-name.js} +23 -142
- package/dist/utils/extract-services.d.ts +6 -0
- package/dist/utils/extract-services.js +29 -0
- package/dist/utils/filter-utils.d.ts +9 -0
- package/dist/utils/filter-utils.js +45 -0
- package/dist/utils/get-files-and-methods.d.ts +21 -0
- package/dist/utils/get-files-and-methods.js +60 -0
- package/dist/utils/middleware.d.ts +39 -0
- package/dist/utils/middleware.js +157 -0
- package/dist/utils/type-utils.d.ts +3 -0
- package/dist/utils/type-utils.js +50 -0
- package/dist/visit.d.ts +3 -3
- package/dist/visit.js +33 -30
- package/package.json +3 -4
- package/src/{add-channel.ts → add/add-channel.ts} +19 -19
- package/src/add/add-cli.ts +663 -0
- package/src/{add-file-extends-core-type.ts → add/add-file-extends-core-type.ts} +21 -6
- package/src/{add-file-with-config.ts → add/add-file-with-config.ts} +2 -2
- package/src/{add-file-with-factory.ts → add/add-file-with-factory.ts} +5 -5
- package/src/{add-functions.ts → add/add-functions.ts} +29 -14
- package/src/{add-http-route.ts → add/add-http-route.ts} +23 -14
- package/src/{add-mcp-prompt.ts → add/add-mcp-prompt.ts} +18 -15
- package/src/{add-mcp-resource.ts → add/add-mcp-resource.ts} +18 -15
- package/src/{add-mcp-tool.ts → add/add-mcp-tool.ts} +18 -15
- package/src/add/add-middleware.ts +326 -0
- package/src/{add-permission.ts → add/add-permission.ts} +4 -8
- package/src/{add-queue-worker.ts → add/add-queue-worker.ts} +17 -14
- package/src/{add-rpc-invocations.ts → add/add-rpc-invocations.ts} +1 -1
- package/src/{add-schedule.ts → add/add-schedule.ts} +17 -14
- package/src/index.ts +5 -0
- package/src/inspector.ts +20 -17
- package/src/types.ts +92 -0
- package/src/{utils.ts → utils/extract-function-name.ts} +25 -199
- package/src/utils/extract-services.ts +35 -0
- package/src/{utils.test.ts → utils/filter-utils.test.ts} +2 -2
- package/src/utils/filter-utils.ts +72 -0
- package/src/utils/get-files-and-methods.ts +143 -0
- package/src/utils/middleware.ts +234 -0
- package/src/utils/type-utils.ts +74 -0
- package/src/visit.ts +47 -33
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/add-functions.d.ts +0 -7
- package/dist/add-mcp-prompt.d.ts +0 -3
- package/dist/add-mcp-resource.d.ts +0 -3
- package/dist/add-mcp-tool.d.ts +0 -3
- package/dist/add-middleware.d.ts +0 -7
- package/dist/add-middleware.js +0 -35
- package/dist/add-permission.d.ts +0 -7
- package/dist/add-queue-worker.d.ts +0 -3
- package/dist/add-schedule.d.ts +0 -3
- package/src/add-middleware.ts +0 -51
- /package/dist/{add-rpc-invocations.js → add/add-rpc-invocations.js} +0 -0
- /package/dist/{does-type-extend-core-type.d.ts → utils/does-type-extend-core-type.d.ts} +0 -0
- /package/dist/{does-type-extend-core-type.js → utils/does-type-extend-core-type.js} +0 -0
- /package/dist/{get-property-value.d.ts → utils/get-property-value.d.ts} +0 -0
- /package/dist/{get-property-value.js → utils/get-property-value.js} +0 -0
- /package/src/{does-type-extend-core-type.ts → utils/does-type-extend-core-type.ts} +0 -0
- /package/src/{get-property-value.ts → utils/get-property-value.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
|
-
import { PathToNameAndType } from '
|
|
2
|
+
import { PathToNameAndType } from '../types.js'
|
|
3
3
|
|
|
4
4
|
export const addFileWithFactory = (
|
|
5
5
|
node: ts.Node,
|
|
@@ -30,13 +30,13 @@ export const addFileWithFactory = (
|
|
|
30
30
|
typeDeclarationPath = sourceFile.fileName // Get the path of the file where the type was declared
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const variables = methods
|
|
33
|
+
const variables = methods.get(fileName) || []
|
|
34
34
|
variables.push({
|
|
35
35
|
variable: variableName,
|
|
36
36
|
type: typeNameNode.getText(),
|
|
37
37
|
typePath: typeDeclarationPath,
|
|
38
38
|
})
|
|
39
|
-
methods
|
|
39
|
+
methods.set(fileName, variables)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// Handle qualified type names if necessary
|
|
@@ -51,13 +51,13 @@ export const addFileWithFactory = (
|
|
|
51
51
|
typeDeclarationPath = sourceFile.fileName // Get the path of the file where the type was declared
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const variables = methods
|
|
54
|
+
const variables = methods.get(fileName) || []
|
|
55
55
|
variables.push({
|
|
56
56
|
variable: variableName,
|
|
57
57
|
type: typeNameNode.getText(),
|
|
58
58
|
typePath: typeDeclarationPath,
|
|
59
59
|
})
|
|
60
|
-
methods
|
|
60
|
+
methods.set(fileName, variables)
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
|
-
import {
|
|
3
|
-
import { TypesMap } from '
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
getPropertyAssignmentInitializer,
|
|
7
|
-
} from './utils.js'
|
|
2
|
+
import { AddWiring } from '../types.js'
|
|
3
|
+
import { TypesMap } from '../types-map.js'
|
|
4
|
+
import { extractFunctionName } from '../utils/extract-function-name.js'
|
|
5
|
+
import { getPropertyAssignmentInitializer } from '../utils/type-utils.js'
|
|
8
6
|
import { FunctionServicesMeta, PikkuDocs } from '@pikku/core'
|
|
9
|
-
import { getPropertyValue } from '
|
|
7
|
+
import { getPropertyValue } from '../utils/get-property-value.js'
|
|
8
|
+
import { resolveMiddleware } from '../utils/middleware.js'
|
|
10
9
|
|
|
11
10
|
const isValidVariableName = (name: string) => {
|
|
12
11
|
const regex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/
|
|
@@ -247,12 +246,7 @@ function unwrapPromise(checker: ts.TypeChecker, type: ts.Type): ts.Type {
|
|
|
247
246
|
* Inspect pikkuFunc calls, extract input/output and first-arg destructuring,
|
|
248
247
|
* then push into state.functions.meta.
|
|
249
248
|
*/
|
|
250
|
-
export
|
|
251
|
-
node: ts.Node,
|
|
252
|
-
checker: ts.TypeChecker,
|
|
253
|
-
state: InspectorState,
|
|
254
|
-
logger: InspectorLogger
|
|
255
|
-
) {
|
|
249
|
+
export const addFunctions: AddWiring = (logger, node, checker, state) => {
|
|
256
250
|
if (!ts.isCallExpression(node)) return
|
|
257
251
|
|
|
258
252
|
const { expression, arguments: args, typeArguments } = node
|
|
@@ -281,6 +275,7 @@ export function addFunctions(
|
|
|
281
275
|
let tags: string[] | undefined
|
|
282
276
|
let expose: boolean | undefined
|
|
283
277
|
let docs: PikkuDocs | undefined
|
|
278
|
+
let objectNode: ts.ObjectLiteralExpression | undefined
|
|
284
279
|
|
|
285
280
|
// determine the actual handler expression:
|
|
286
281
|
// either the `func` prop or the first argument directly
|
|
@@ -289,6 +284,7 @@ export function addFunctions(
|
|
|
289
284
|
|
|
290
285
|
if (ts.isObjectLiteralExpression(handlerNode)) {
|
|
291
286
|
isDirectFunction = false // This is object format with func property
|
|
287
|
+
objectNode = handlerNode
|
|
292
288
|
tags = (getPropertyValue(handlerNode, 'tags') as string[]) || undefined
|
|
293
289
|
expose = getPropertyValue(handlerNode, 'expose') as boolean | undefined
|
|
294
290
|
docs = getPropertyValue(handlerNode, 'docs') as PikkuDocs | undefined
|
|
@@ -347,7 +343,7 @@ export function addFunctions(
|
|
|
347
343
|
.map((t) => unwrapPromise(checker, t))
|
|
348
344
|
|
|
349
345
|
// --- Input Extraction ---
|
|
350
|
-
let { names: inputNames } = getNamesAndTypes(
|
|
346
|
+
let { names: inputNames, types: inputTypes } = getNamesAndTypes(
|
|
351
347
|
checker,
|
|
352
348
|
state.functions.typesMap,
|
|
353
349
|
'Input',
|
|
@@ -391,6 +387,11 @@ export function addFunctions(
|
|
|
391
387
|
)
|
|
392
388
|
}
|
|
393
389
|
|
|
390
|
+
// --- resolve middleware ---
|
|
391
|
+
const middleware = objectNode
|
|
392
|
+
? resolveMiddleware(state, objectNode, tags, checker)
|
|
393
|
+
: undefined
|
|
394
|
+
|
|
394
395
|
state.functions.meta[pikkuFuncName] = {
|
|
395
396
|
pikkuFuncName,
|
|
396
397
|
name,
|
|
@@ -403,6 +404,20 @@ export function addFunctions(
|
|
|
403
404
|
tags: tags || undefined,
|
|
404
405
|
docs: docs || undefined,
|
|
405
406
|
isDirectFunction,
|
|
407
|
+
middleware,
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Store the input type for later use
|
|
411
|
+
if (inputTypes.length > 0) {
|
|
412
|
+
state.typesLookup.set(pikkuFuncName, inputTypes)
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// Store function file location for wiring generation
|
|
416
|
+
if (exportedName) {
|
|
417
|
+
state.functions.files.set(pikkuFuncName, {
|
|
418
|
+
path: node.getSourceFile().fileName,
|
|
419
|
+
exportedName,
|
|
420
|
+
})
|
|
406
421
|
}
|
|
407
422
|
|
|
408
423
|
if (exportedName || explicitName) {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
|
-
import { getPropertyValue } from '
|
|
2
|
+
import { getPropertyValue } from '../utils/get-property-value.js'
|
|
3
3
|
import { pathToRegexp } from 'path-to-regexp'
|
|
4
4
|
import { HTTPMethod } from '@pikku/core/http'
|
|
5
5
|
import { PikkuDocs, PikkuWiringTypes } from '@pikku/core'
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from '
|
|
11
|
-
import { InspectorState, InspectorFilters, InspectorLogger } from './types.js'
|
|
6
|
+
import { extractFunctionName } from '../utils/extract-function-name.js'
|
|
7
|
+
import { getPropertyAssignmentInitializer } from '../utils/type-utils.js'
|
|
8
|
+
import { matchesFilters } from '../utils/filter-utils.js'
|
|
9
|
+
import { AddWiring } from '../types.js'
|
|
10
|
+
import { resolveHTTPMiddlewareFromObject } from '../utils/middleware.js'
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Populate metaInputTypes for a given route based on method, input type,
|
|
@@ -39,12 +38,12 @@ export const getInputTypes = (
|
|
|
39
38
|
* Simplified wireHTTP: re-uses function metadata from state.functions.meta
|
|
40
39
|
* instead of re-inferring types here.
|
|
41
40
|
*/
|
|
42
|
-
export const addHTTPRoute = (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
export const addHTTPRoute: AddWiring = (
|
|
42
|
+
logger,
|
|
43
|
+
node,
|
|
44
|
+
checker,
|
|
45
|
+
state,
|
|
46
|
+
options
|
|
48
47
|
) => {
|
|
49
48
|
// only look at calls
|
|
50
49
|
if (!ts.isCallExpression(node)) return
|
|
@@ -74,7 +73,7 @@ export const addHTTPRoute = (
|
|
|
74
73
|
|
|
75
74
|
if (
|
|
76
75
|
!matchesFilters(
|
|
77
|
-
filters,
|
|
76
|
+
options.filters || {},
|
|
78
77
|
{ tags },
|
|
79
78
|
{ type: PikkuWiringTypes.http, name: route, filePath },
|
|
80
79
|
logger
|
|
@@ -114,6 +113,15 @@ export const addHTTPRoute = (
|
|
|
114
113
|
params
|
|
115
114
|
)
|
|
116
115
|
|
|
116
|
+
// --- resolve middleware ---
|
|
117
|
+
const middleware = resolveHTTPMiddlewareFromObject(
|
|
118
|
+
state,
|
|
119
|
+
route,
|
|
120
|
+
obj,
|
|
121
|
+
tags,
|
|
122
|
+
checker
|
|
123
|
+
)
|
|
124
|
+
|
|
117
125
|
// --- record route ---
|
|
118
126
|
state.http.files.add(node.getSourceFile().fileName)
|
|
119
127
|
state.http.meta[method][route] = {
|
|
@@ -125,5 +133,6 @@ export const addHTTPRoute = (
|
|
|
125
133
|
inputTypes,
|
|
126
134
|
docs,
|
|
127
135
|
tags,
|
|
136
|
+
middleware,
|
|
128
137
|
}
|
|
129
138
|
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
|
-
import { getPropertyValue } from '
|
|
2
|
+
import { getPropertyValue } from '../utils/get-property-value.js'
|
|
3
3
|
import { PikkuWiringTypes } from '@pikku/core'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
node
|
|
13
|
-
checker
|
|
14
|
-
state
|
|
15
|
-
|
|
16
|
-
logger: InspectorLogger
|
|
4
|
+
import { AddWiring } from '../types.js'
|
|
5
|
+
import { extractFunctionName } from '../utils/extract-function-name.js'
|
|
6
|
+
import { getPropertyAssignmentInitializer } from '../utils/type-utils.js'
|
|
7
|
+
import { matchesFilters } from '../utils/filter-utils.js'
|
|
8
|
+
import { resolveMiddleware } from '../utils/middleware.js'
|
|
9
|
+
|
|
10
|
+
export const addMCPPrompt: AddWiring = (
|
|
11
|
+
logger,
|
|
12
|
+
node,
|
|
13
|
+
checker,
|
|
14
|
+
state,
|
|
15
|
+
options
|
|
17
16
|
) => {
|
|
18
17
|
if (!ts.isCallExpression(node)) {
|
|
19
18
|
return
|
|
@@ -71,7 +70,7 @@ export const addMCPPrompt = (
|
|
|
71
70
|
|
|
72
71
|
if (
|
|
73
72
|
!matchesFilters(
|
|
74
|
-
filters,
|
|
73
|
+
options.filters || {},
|
|
75
74
|
{ tags },
|
|
76
75
|
{ type: PikkuWiringTypes.mcp, name: nameValue, filePath },
|
|
77
76
|
logger
|
|
@@ -89,6 +88,9 @@ export const addMCPPrompt = (
|
|
|
89
88
|
const inputSchema = fnMeta.inputs?.[0] || null
|
|
90
89
|
const outputSchema = fnMeta.outputs?.[0] || null
|
|
91
90
|
|
|
91
|
+
// --- resolve middleware ---
|
|
92
|
+
const middleware = resolveMiddleware(state, obj, tags, checker)
|
|
93
|
+
|
|
92
94
|
state.mcpEndpoints.files.add(node.getSourceFile().fileName)
|
|
93
95
|
|
|
94
96
|
state.mcpEndpoints.promptsMeta[nameValue] = {
|
|
@@ -99,6 +101,7 @@ export const addMCPPrompt = (
|
|
|
99
101
|
inputSchema,
|
|
100
102
|
outputSchema,
|
|
101
103
|
arguments: [], // Will be populated by CLI during serialization
|
|
104
|
+
middleware,
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
|
-
import { getPropertyValue } from '
|
|
2
|
+
import { getPropertyValue } from '../utils/get-property-value.js'
|
|
3
3
|
import { PikkuWiringTypes } from '@pikku/core'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
node
|
|
13
|
-
checker
|
|
14
|
-
state
|
|
15
|
-
|
|
16
|
-
logger: InspectorLogger
|
|
4
|
+
import { AddWiring } from '../types.js'
|
|
5
|
+
import { extractFunctionName } from '../utils/extract-function-name.js'
|
|
6
|
+
import { getPropertyAssignmentInitializer } from '../utils/type-utils.js'
|
|
7
|
+
import { matchesFilters } from '../utils/filter-utils.js'
|
|
8
|
+
import { resolveMiddleware } from '../utils/middleware.js'
|
|
9
|
+
|
|
10
|
+
export const addMCPResource: AddWiring = (
|
|
11
|
+
logger,
|
|
12
|
+
node,
|
|
13
|
+
checker,
|
|
14
|
+
state,
|
|
15
|
+
options
|
|
17
16
|
) => {
|
|
18
17
|
if (!ts.isCallExpression(node)) {
|
|
19
18
|
return
|
|
@@ -82,7 +81,7 @@ export const addMCPResource = (
|
|
|
82
81
|
|
|
83
82
|
if (
|
|
84
83
|
!matchesFilters(
|
|
85
|
-
filters,
|
|
84
|
+
options.filters || {},
|
|
86
85
|
{ tags },
|
|
87
86
|
{ type: PikkuWiringTypes.mcp, name: uriValue, filePath },
|
|
88
87
|
logger
|
|
@@ -100,6 +99,9 @@ export const addMCPResource = (
|
|
|
100
99
|
const inputSchema = fnMeta.inputs?.[0] || null
|
|
101
100
|
const outputSchema = fnMeta.outputs?.[0] || null
|
|
102
101
|
|
|
102
|
+
// --- resolve middleware ---
|
|
103
|
+
const middleware = resolveMiddleware(state, obj, tags, checker)
|
|
104
|
+
|
|
103
105
|
state.mcpEndpoints.files.add(node.getSourceFile().fileName)
|
|
104
106
|
|
|
105
107
|
state.mcpEndpoints.resourcesMeta[uriValue] = {
|
|
@@ -111,6 +113,7 @@ export const addMCPResource = (
|
|
|
111
113
|
tags,
|
|
112
114
|
inputSchema,
|
|
113
115
|
outputSchema,
|
|
116
|
+
middleware,
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
|
-
import { getPropertyValue } from '
|
|
2
|
+
import { getPropertyValue } from '../utils/get-property-value.js'
|
|
3
3
|
import { PikkuWiringTypes } from '@pikku/core'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
node
|
|
13
|
-
checker
|
|
14
|
-
state
|
|
15
|
-
|
|
16
|
-
logger: InspectorLogger
|
|
4
|
+
import { AddWiring } from '../types.js'
|
|
5
|
+
import { extractFunctionName } from '../utils/extract-function-name.js'
|
|
6
|
+
import { getPropertyAssignmentInitializer } from '../utils/type-utils.js'
|
|
7
|
+
import { matchesFilters } from '../utils/filter-utils.js'
|
|
8
|
+
import { resolveMiddleware } from '../utils/middleware.js'
|
|
9
|
+
|
|
10
|
+
export const addMCPTool: AddWiring = (
|
|
11
|
+
logger,
|
|
12
|
+
node,
|
|
13
|
+
checker,
|
|
14
|
+
state,
|
|
15
|
+
options
|
|
17
16
|
) => {
|
|
18
17
|
if (!ts.isCallExpression(node)) {
|
|
19
18
|
return
|
|
@@ -73,7 +72,7 @@ export const addMCPTool = (
|
|
|
73
72
|
|
|
74
73
|
if (
|
|
75
74
|
!matchesFilters(
|
|
76
|
-
filters,
|
|
75
|
+
options.filters || {},
|
|
77
76
|
{ tags },
|
|
78
77
|
{ type: PikkuWiringTypes.mcp, name: nameValue, filePath },
|
|
79
78
|
logger
|
|
@@ -91,6 +90,9 @@ export const addMCPTool = (
|
|
|
91
90
|
const inputSchema = fnMeta.inputs?.[0] || null
|
|
92
91
|
const outputSchema = fnMeta.outputs?.[0] || null
|
|
93
92
|
|
|
93
|
+
// --- resolve middleware ---
|
|
94
|
+
const middleware = resolveMiddleware(state, obj, tags, checker)
|
|
95
|
+
|
|
94
96
|
state.mcpEndpoints.files.add(node.getSourceFile().fileName)
|
|
95
97
|
|
|
96
98
|
state.mcpEndpoints.toolsMeta[nameValue] = {
|
|
@@ -102,6 +104,7 @@ export const addMCPTool = (
|
|
|
102
104
|
tags,
|
|
103
105
|
inputSchema,
|
|
104
106
|
outputSchema,
|
|
107
|
+
middleware,
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
}
|