@toa.io/extensions.exposition 1.0.0-alpha.284 → 1.0.0-alpha.285
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 +11 -0
- package/documentation/mcp.md +7 -1
- package/documentation/rpc.md +21 -17
- package/features/mcp.feature +32 -28
- package/features/oauth.grants.feature +1 -1
- package/features/rpc.feature +21 -21
- package/features/steps/Gateway.ts +4 -3
- package/package.json +2 -2
- package/source/Introspection.ts +4 -1
- package/source/MCP/tools.ts +1 -0
- package/source/MCP/types.ts +4 -1
- package/source/RPC/names.test.ts +22 -22
- package/source/RPC/names.ts +4 -3
- package/source/RTD/walk.test.ts +5 -5
- package/source/directives/mcp/MCP.ts +8 -1
- package/source/directives/mcp/Tool.test.ts +26 -2
- package/source/directives/mcp/Tool.ts +23 -4
- package/transpiled/Introspection.d.ts +2 -0
- package/transpiled/Introspection.js +1 -1
- package/transpiled/Introspection.js.map +1 -1
- package/transpiled/MCP/tools.js +1 -0
- package/transpiled/MCP/tools.js.map +1 -1
- package/transpiled/MCP/types.d.ts +3 -1
- package/transpiled/RPC/names.d.ts +3 -2
- package/transpiled/RPC/names.js +1 -1
- package/transpiled/RPC/names.js.map +1 -1
- package/transpiled/directives/mcp/MCP.js +7 -1
- package/transpiled/directives/mcp/MCP.js.map +1 -1
- package/transpiled/directives/mcp/Tool.d.ts +6 -1
- package/transpiled/directives/mcp/Tool.js +14 -3
- package/transpiled/directives/mcp/Tool.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/source/RPC/names.test.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { address, name, refusal } from './names.js'
|
|
|
7
7
|
|
|
8
8
|
describe('address', () => {
|
|
9
9
|
it('should resolve a name without variables', () => {
|
|
10
|
-
assert.deepEqual(address('pots
|
|
10
|
+
assert.deepEqual(address('pots.GET', {}),
|
|
11
11
|
{ path: '/pots/', verb: 'GET', variables: [] })
|
|
12
12
|
})
|
|
13
13
|
|
|
@@ -17,55 +17,55 @@ describe('address', () => {
|
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
it('should substitute a variable and report it taken', () => {
|
|
20
|
-
assert.deepEqual(address('pots
|
|
20
|
+
assert.deepEqual(address('pots._id.GET', { id: 'a1b2', title: 'Kettle' }),
|
|
21
21
|
{ path: '/pots/a1b2/', verb: 'GET', variables: ['id'] })
|
|
22
22
|
})
|
|
23
23
|
|
|
24
24
|
it('should substitute every variable', () => {
|
|
25
|
-
assert.deepEqual(address('users
|
|
25
|
+
assert.deepEqual(address('users._user.pots._id.PATCH', { user: 'bob', id: 'a1b2' }),
|
|
26
26
|
{ path: '/users/bob/pots/a1b2/', verb: 'PATCH', variables: ['user', 'id'] })
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
it('should let a tail carry separators', () => {
|
|
30
|
-
assert.deepEqual(address('files
|
|
30
|
+
assert.deepEqual(address('files.__.GET', { '**': 'a/b/c' }),
|
|
31
31
|
{ path: '/files/a/b/c/', verb: 'GET', variables: ['**'] })
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
it('should not confuse a trailing literal with a verb', () => {
|
|
35
|
-
assert.deepEqual(address('pots
|
|
35
|
+
assert.deepEqual(address('pots.GET.POST', {}),
|
|
36
36
|
{ path: '/pots/GET/', verb: 'POST', variables: [] })
|
|
37
37
|
})
|
|
38
38
|
|
|
39
39
|
it('should refuse a name that states no verb', () => {
|
|
40
|
-
assert.throws(() => address('pots
|
|
40
|
+
assert.throws(() => address('pots._id', { id: 'a1b2' }), http.NotFound)
|
|
41
41
|
})
|
|
42
42
|
|
|
43
43
|
it('should refuse a verb no method uses', () => {
|
|
44
|
-
assert.throws(() => address('pots
|
|
44
|
+
assert.throws(() => address('pots.FETCH', {}), http.NotFound)
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
it('should refuse a segment no name can spell', () => {
|
|
48
|
-
assert.throws(() => address('pots/v1.
|
|
49
|
-
assert.throws(() => address('a_b
|
|
50
|
-
assert.throws(() => address('pots
|
|
48
|
+
assert.throws(() => address('pots/v1.GET', {}), http.NotFound)
|
|
49
|
+
assert.throws(() => address('a_b.GET', {}), http.NotFound)
|
|
50
|
+
assert.throws(() => address('pots..GET', {}), http.NotFound)
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
it('should refuse a variable of no name', () => {
|
|
54
|
-
assert.throws(() => address('pots
|
|
54
|
+
assert.throws(() => address('pots._.GET', { '': 'a1b2' }), http.NotFound)
|
|
55
55
|
})
|
|
56
56
|
|
|
57
57
|
it('should refuse a missing variable', () => {
|
|
58
|
-
assert.throws(() => address('pots
|
|
58
|
+
assert.throws(() => address('pots._id.GET', {}), http.BadRequest)
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
it('should refuse a variable that would divide the path', () => {
|
|
62
|
-
assert.throws(() => address('pots
|
|
63
|
-
assert.throws(() => address('pots
|
|
64
|
-
assert.throws(() => address('pots
|
|
62
|
+
assert.throws(() => address('pots._id.GET', { id: 'a/b' }), http.BadRequest)
|
|
63
|
+
assert.throws(() => address('pots._id.GET', { id: 'a?b' }), http.BadRequest)
|
|
64
|
+
assert.throws(() => address('pots._id.GET', { id: 'a#b' }), http.BadRequest)
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
it('should refuse a tail that would end the path', () => {
|
|
68
|
-
assert.throws(() => address('files
|
|
68
|
+
assert.throws(() => address('files.__.GET', { '**': 'a?b' }), http.BadRequest)
|
|
69
69
|
})
|
|
70
70
|
})
|
|
71
71
|
|
|
@@ -75,22 +75,22 @@ describe('name', () => {
|
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
it('should name a route', () => {
|
|
78
|
-
assert.equal(name(segment('/pots'), 'GET'), 'pots
|
|
79
|
-
assert.equal(name(segment('/identity/tokens'), 'POST'), 'identity
|
|
78
|
+
assert.equal(name(segment('/pots'), 'GET'), 'pots.GET')
|
|
79
|
+
assert.equal(name(segment('/identity/tokens'), 'POST'), 'identity.tokens.POST')
|
|
80
80
|
})
|
|
81
81
|
|
|
82
82
|
it('should mark a variable', () => {
|
|
83
|
-
assert.equal(name(segment('/pots/:id'), 'GET'), 'pots
|
|
83
|
+
assert.equal(name(segment('/pots/:id'), 'GET'), 'pots._id.GET')
|
|
84
84
|
assert.equal(name(segment('/identity/tokens/:identity'), 'POST'),
|
|
85
|
-
'identity
|
|
85
|
+
'identity.tokens._identity.POST')
|
|
86
86
|
})
|
|
87
87
|
|
|
88
88
|
it('should mark a tail', () => {
|
|
89
|
-
assert.equal(name(segment('/files/**'), 'GET'), 'files
|
|
89
|
+
assert.equal(name(segment('/files/**'), 'GET'), 'files.__.GET')
|
|
90
90
|
})
|
|
91
91
|
|
|
92
92
|
it('should keep a hyphen', () => {
|
|
93
|
-
assert.equal(name(segment('/jpeg-or-png'), 'GET'), 'jpeg-or-png
|
|
93
|
+
assert.equal(name(segment('/jpeg-or-png'), 'GET'), 'jpeg-or-png.GET')
|
|
94
94
|
})
|
|
95
95
|
|
|
96
96
|
it('should name nothing where a segment cannot be spelled', () => {
|
package/source/RPC/names.ts
CHANGED
|
@@ -7,8 +7,9 @@ import { QUERY, type Params } from './types.js'
|
|
|
7
7
|
* What a name resolves to: the path the call is made at, and the verb it is made with.
|
|
8
8
|
*
|
|
9
9
|
* A name is the route template with its variables marked and the verb appended as a segment
|
|
10
|
-
* of its own — `pots
|
|
11
|
-
*
|
|
10
|
+
* of its own — `pots._id.GET`. The revision names the characters a tool's name may hold, and
|
|
11
|
+
* `/` is not among them, so segments are joined by `.` — which a segment cannot hold either,
|
|
12
|
+
* so nothing in a name can be mistaken for anything else, and the verb is always last.
|
|
12
13
|
*/
|
|
13
14
|
export interface Address {
|
|
14
15
|
path: string
|
|
@@ -161,7 +162,7 @@ function declared (segment: Segment): string {
|
|
|
161
162
|
return segment.placeholder === null ? '*' : ':' + segment.placeholder
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
const SEPARATOR = '
|
|
165
|
+
const SEPARATOR = '.'
|
|
165
166
|
const VARIABLE = '_'
|
|
166
167
|
const TAIL = '__'
|
|
167
168
|
|
package/source/RTD/walk.test.ts
CHANGED
|
@@ -52,7 +52,7 @@ describe('walk', () => {
|
|
|
52
52
|
]), endpoints, directives)
|
|
53
53
|
|
|
54
54
|
assert.deepEqual(names(tree).sort(), [
|
|
55
|
-
'pots
|
|
55
|
+
'pots.GET', 'pots.POST', 'pots._id.DELETE', 'pots._id.GET'
|
|
56
56
|
])
|
|
57
57
|
})
|
|
58
58
|
|
|
@@ -61,14 +61,14 @@ describe('walk', () => {
|
|
|
61
61
|
|
|
62
62
|
tree.merge(trunk([node('/pots', ['GET'])]), { namespace: 'default', component: 'pots' })
|
|
63
63
|
|
|
64
|
-
assert.deepEqual(names(tree), ['pots
|
|
64
|
+
assert.deepEqual(names(tree), ['pots.GET'])
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
it('should name a tail', () => {
|
|
68
68
|
const tree = new Tree(trunk([node('/files', [], [node('/**', ['GET'])])]),
|
|
69
69
|
endpoints, directives)
|
|
70
70
|
|
|
71
|
-
assert.deepEqual(names(tree), ['files
|
|
71
|
+
assert.deepEqual(names(tree), ['files.__.GET'])
|
|
72
72
|
})
|
|
73
73
|
|
|
74
74
|
it('should skip an intermediate node, whose route answers in its place', () => {
|
|
@@ -77,14 +77,14 @@ describe('walk', () => {
|
|
|
77
77
|
node('/posts', ['PATCH'], [node('/', ['PUT'])])
|
|
78
78
|
]), endpoints, directives)
|
|
79
79
|
|
|
80
|
-
assert.deepEqual(names(tree), ['posts
|
|
80
|
+
assert.deepEqual(names(tree), ['posts.PUT'])
|
|
81
81
|
})
|
|
82
82
|
|
|
83
83
|
it('should name nothing where a segment cannot be spelled', () => {
|
|
84
84
|
const tree = new Tree(trunk([node('/v1.0', ['GET']), node('/pots', ['GET'])]),
|
|
85
85
|
endpoints, directives)
|
|
86
86
|
|
|
87
|
-
assert.deepEqual(names(tree), ['pots
|
|
87
|
+
assert.deepEqual(names(tree), ['pots.GET'])
|
|
88
88
|
})
|
|
89
89
|
|
|
90
90
|
it('should name what the tree then matches', () => {
|
|
@@ -28,6 +28,13 @@ export class MCP implements DirectiveFamily<Tool> {
|
|
|
28
28
|
introspection: Introspection): Introspection {
|
|
29
29
|
const tool = MCP.published(directives)
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
if (tool === null)
|
|
32
|
+
return introspection
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
...introspection,
|
|
36
|
+
description: tool.description,
|
|
37
|
+
...tool.title === undefined ? {} : { title: tool.title }
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
}
|
|
@@ -5,8 +5,31 @@ import { MCP } from './MCP.js'
|
|
|
5
5
|
|
|
6
6
|
describe('mcp:tool', () => {
|
|
7
7
|
it('should take what the route states the tool is', () => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const tool = new Tool('The pots that are hot.', '/pots/hot')
|
|
9
|
+
|
|
10
|
+
assert.strictEqual(tool.description, 'The pots that are hot.')
|
|
11
|
+
assert.strictEqual(tool.title, undefined)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('should take a title beside the description', () => {
|
|
15
|
+
const tool = new Tool({ title: 'Hot pots', description: 'The pots that are hot.' }, '/pots')
|
|
16
|
+
|
|
17
|
+
assert.strictEqual(tool.title, 'Hot pots')
|
|
18
|
+
assert.strictEqual(tool.description, 'The pots that are hot.')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('should not accept a mapping without a description', () => {
|
|
22
|
+
assert.throws(() => new Tool({ title: 'Hot pots' }, '/pots'), /cannot be empty/)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('should not accept an empty title', () => {
|
|
26
|
+
assert.throws(() => new Tool({ title: ' ', description: 'A pot.' }, '/pots'),
|
|
27
|
+
/a title cannot be empty/)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('should not accept what it does not know', () => {
|
|
31
|
+
assert.throws(() => new Tool({ description: 'A pot.', name: 'pots' }, '/pots'),
|
|
32
|
+
/unknown 'name'/)
|
|
10
33
|
})
|
|
11
34
|
|
|
12
35
|
it('should not accept an empty description', () => {
|
|
@@ -18,6 +41,7 @@ describe('mcp:tool', () => {
|
|
|
18
41
|
assert.throws(() => new Tool(true, '/pots'), /the value is what the tool is/)
|
|
19
42
|
assert.throws(() => new Tool(false, '/pots'), /the value is what the tool is/)
|
|
20
43
|
assert.throws(() => new Tool(1, '/pots'), /the value is what the tool is/)
|
|
44
|
+
assert.throws(() => new Tool(['A pot.'], '/pots'), /the value is what the tool is/)
|
|
21
45
|
})
|
|
22
46
|
|
|
23
47
|
it('should refuse a route no name can spell', () => {
|
|
@@ -7,22 +7,41 @@ import { segment } from '../../RTD/segment.js'
|
|
|
7
7
|
* says is what it says it is: a tool a model cannot read the purpose of is one it cannot
|
|
8
8
|
* choose, so there is no way to publish one that states nothing.
|
|
9
9
|
*
|
|
10
|
+
* A `title` is what a person is shown where a client lists what it may call — a name is an
|
|
11
|
+
* address and reads as one. A description alone is written as the value; both are written as
|
|
12
|
+
* a mapping.
|
|
13
|
+
*
|
|
10
14
|
* The operation states what it is too, and that is not this. An operation is written without
|
|
11
15
|
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
12
|
-
* operation mounted twice is two tools, and one sentence
|
|
16
|
+
* operation mounted twice is two tools, and one sentence is not true of both.
|
|
13
17
|
*/
|
|
14
18
|
export class Tool {
|
|
15
19
|
public readonly description: string
|
|
20
|
+
public readonly title: string | undefined
|
|
16
21
|
|
|
17
22
|
public constructor (value: unknown, route: string) {
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
const stated = typeof value === 'string' ? { description: value } : value
|
|
24
|
+
|
|
25
|
+
assert.ok(typeof stated === 'object' && stated !== null && !Array.isArray(stated),
|
|
26
|
+
'Directive mcp:tool: the value is what the tool is, or a `title` and a `description`')
|
|
27
|
+
|
|
28
|
+
const { description, title, ...rest } = stated as Record<string, unknown>
|
|
29
|
+
|
|
30
|
+
assert.ok(Object.keys(rest).length === 0,
|
|
31
|
+
`Directive mcp:tool: unknown ${Object.keys(rest).map((key) => `'${key}'`).join(', ')}`)
|
|
32
|
+
|
|
33
|
+
assert.ok(typeof description === 'string' && description.trim().length > 0,
|
|
34
|
+
'Directive mcp:tool: a description cannot be empty')
|
|
35
|
+
|
|
36
|
+
assert.ok(title === undefined || (typeof title === 'string' && title.trim().length > 0),
|
|
37
|
+
'Directive mcp:tool: a title cannot be empty')
|
|
20
38
|
|
|
21
39
|
// a tool is called by name, so a route that cannot be named cannot be one — said where
|
|
22
40
|
// the mistake is, rather than as a tool that is quietly never listed
|
|
23
41
|
assert.ok(refusal(segment(route)) === null,
|
|
24
42
|
`Directive mcp:tool: '${route}' holds a segment no tool name can spell`)
|
|
25
43
|
|
|
26
|
-
this.description =
|
|
44
|
+
this.description = description
|
|
45
|
+
this.title = title as string | undefined
|
|
27
46
|
}
|
|
28
47
|
}
|
|
@@ -7,6 +7,8 @@ export interface Introspection {
|
|
|
7
7
|
* one sentence cannot be true of both. The operation's own is for the Introspection.
|
|
8
8
|
*/
|
|
9
9
|
description?: string;
|
|
10
|
+
/** what a person is shown where a client lists this method, which a name is not */
|
|
11
|
+
title?: string;
|
|
10
12
|
route?: Record<string, Schema>;
|
|
11
13
|
query?: Record<string, Schema>;
|
|
12
14
|
/** what a request header carries, which is therefore not the body's to send */
|
|
@@ -9,7 +9,7 @@ export function order(introspection) {
|
|
|
9
9
|
ordered[key] = introspection[key];
|
|
10
10
|
return ordered;
|
|
11
11
|
}
|
|
12
|
-
const KEYS = ['description', 'route', 'query', 'headers', 'input', 'output', 'errors'];
|
|
12
|
+
const KEYS = ['title', 'description', 'route', 'query', 'headers', 'input', 'output', 'errors'];
|
|
13
13
|
/**
|
|
14
14
|
* The schema of one input property, taken out of it: a property another family fills is
|
|
15
15
|
* not the caller's to send, and what took it says where it comes from instead.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Introspection.js","sourceRoot":"","sources":["../source/Introspection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Introspection.js","sourceRoot":"","sources":["../source/Introspection.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAE,aAA4B;IACjD,MAAM,OAAO,GAAkB,EAAE,CAAA;IAEjC,KAAK,MAAM,GAAG,IAAI,IAAI;QACpB,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,SAAS;YACjC,OAAO,CAAC,GAAG,CAAa,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;IAElD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAA;AAExG;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAE,OAAgB,EAAE,QAAgB;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAiC,CAAA;IACvD,MAAM,UAAU,GAAG,KAAK,EAAE,UAAU,CAAA;IAEpC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS;QACnE,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC;QACzB,OAAO,SAAS,CAAA;IAElB,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAA;IAEnC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAA;IAE3B,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAC9B,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAA;IAErE,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAE,MAA0B,EAAE,OAAoB;IACxE,MAAM,KAAK,GAAG,MAAkC,CAAA;IAEhD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QACvC,OAAO,MAAM,CAAA;IAEf,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAC3B,OAAO,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,EAAuB,CAAA;IAEjF,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAChC,OAAO,MAAM,CAAA;IAEf,MAAM,UAAU,GAA2B,EAAE,CAAA;IAE7C,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;QAC7D,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAA;IAE/B,MAAM,UAAU,GAAU,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,CAAA;IAElD,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAC9B,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;IAE1E,OAAO,UAA+B,CAAA;AACxC,CAAC"}
|
package/transpiled/MCP/tools.js
CHANGED
|
@@ -41,6 +41,7 @@ export async function list(tree, context) {
|
|
|
41
41
|
// in the order the revision documents one, which is the order it is read in
|
|
42
42
|
const tool = {
|
|
43
43
|
name: named,
|
|
44
|
+
...introspection.title === undefined ? {} : { title: introspection.title },
|
|
44
45
|
...described === undefined ? {} : { description: described },
|
|
45
46
|
inputSchema: input(introspection, variables.map((variable) => variable.name)),
|
|
46
47
|
...schema === undefined ? {} : { outputSchema: schema },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../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AC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACvD,iBAAiB,EAAE,IAAI;KACxB,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAE,QAAmB;IACtC,MAAM,MAAM,GAAgB,EAAE,CAAA;IAE9B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;YAC3B,SAAQ;QAEV,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;YAC3B,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAA;aACnC,IAAI,OAAO,CAAC,WAAW,KAAK,IAAI;YACnC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAA;IACzD,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -50,7 +50,9 @@ export interface Content {
|
|
|
50
50
|
}
|
|
51
51
|
export interface Tool {
|
|
52
52
|
name: string;
|
|
53
|
-
/** what
|
|
53
|
+
/** what a person is shown where a client lists this tool; a name is an address */
|
|
54
|
+
title?: string;
|
|
55
|
+
/** what the route states this method is */
|
|
54
56
|
description?: string;
|
|
55
57
|
inputSchema: object;
|
|
56
58
|
outputSchema?: object;
|
|
@@ -4,8 +4,9 @@ import { type Params } from './types.js';
|
|
|
4
4
|
* What a name resolves to: the path the call is made at, and the verb it is made with.
|
|
5
5
|
*
|
|
6
6
|
* A name is the route template with its variables marked and the verb appended as a segment
|
|
7
|
-
* of its own — `pots
|
|
8
|
-
*
|
|
7
|
+
* of its own — `pots._id.GET`. The revision names the characters a tool's name may hold, and
|
|
8
|
+
* `/` is not among them, so segments are joined by `.` — which a segment cannot hold either,
|
|
9
|
+
* so nothing in a name can be mistaken for anything else, and the verb is always last.
|
|
9
10
|
*/
|
|
10
11
|
export interface Address {
|
|
11
12
|
path: string;
|
package/transpiled/RPC/names.js
CHANGED
|
@@ -103,7 +103,7 @@ function declared(segment) {
|
|
|
103
103
|
return '**';
|
|
104
104
|
return segment.placeholder === null ? '*' : ':' + segment.placeholder;
|
|
105
105
|
}
|
|
106
|
-
const SEPARATOR = '
|
|
106
|
+
const SEPARATOR = '.';
|
|
107
107
|
const VARIABLE = '_';
|
|
108
108
|
const TAIL = '__';
|
|
109
109
|
/** How the RTD names the rest of a path, wherever a parameter of it is read. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../source/RPC/names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,EAAE,KAAK,EAAe,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../source/RPC/names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,EAAE,KAAK,EAAe,MAAM,YAAY,CAAA;AAkB/C,MAAM,UAAU,OAAO,CAAE,MAAc,EAAE,MAAc;IACrD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACrC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,EAAG,CAAA;IAEzB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;QAClB,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,MAAM,mBAAmB,CAAC,CAAA;IAExD,MAAM,SAAS,GAAa,EAAE,CAAA;IAC9B,MAAM,SAAS,GAAa,EAAE,CAAA;IAE9B,KAAK,MAAM,IAAI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mB;IAC3C,OAAO,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAED,SAAS,QAAQ,CAAE,OAAgB;IACjC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;QAC3B,OAAO,OAAO,CAAC,QAAQ,CAAA;IAEzB,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;QAC3B,OAAO,IAAI,CAAA;IAEb,OAAO,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,WAAW,CAAA;AACvE,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,CAAA;AACrB,MAAM,QAAQ,GAAG,GAAG,CAAA;AACpB,MAAM,IAAI,GAAG,IAAI,CAAA;AAEjB,gFAAgF;AAChF,MAAM,QAAQ,GAAG,IAAI,CAAA;AAErB;;;;GAIG;AACH,MAAM,QAAQ,GAAG,iBAAiB,CAAA;AAElC,qDAAqD;AACrD,MAAM,MAAM,GAAG,WAAW,CAAA;AAE1B,2FAA2F;AAC3F,MAAM,MAAM,GAAG,UAAU,CAAA"}
|
|
@@ -17,7 +17,13 @@ export class MCP {
|
|
|
17
17
|
/** What the route states this method is, which is the only thing that states it. */
|
|
18
18
|
explain(directives, _, introspection) {
|
|
19
19
|
const tool = MCP.published(directives);
|
|
20
|
-
|
|
20
|
+
if (tool === null)
|
|
21
|
+
return introspection;
|
|
22
|
+
return {
|
|
23
|
+
...introspection,
|
|
24
|
+
description: tool.description,
|
|
25
|
+
...tool.title === undefined ? {} : { title: tool.title }
|
|
26
|
+
};
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
//# sourceMappingURL=MCP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MCP.js","sourceRoot":"","sources":["../../../source/directives/mcp/MCP.ts"],"names":[],"mappings":"AAAA,OAAO,MA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,KAAa;QACpE,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,MAAM,EAAE,0BAA0B,IAAI,EAAE,CAAC,CAAA;QAE5D,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,oFAAoF;IAC7E,OAAO,CAAE,UAAkB,EAAE,CAAU,EAC5C,aAA4B;QAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QAEtC,IAAI,IAAI,KAAK,IAAI;YACf,OAAO,aAAa,CAAA;QAEtB,OAAO;YACL,GAAG,aAAa;YAChB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;SACzD,CAAA;IACH,CAAC;CACF"}
|
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
* says is what it says it is: a tool a model cannot read the purpose of is one it cannot
|
|
4
4
|
* choose, so there is no way to publish one that states nothing.
|
|
5
5
|
*
|
|
6
|
+
* A `title` is what a person is shown where a client lists what it may call — a name is an
|
|
7
|
+
* address and reads as one. A description alone is written as the value; both are written as
|
|
8
|
+
* a mapping.
|
|
9
|
+
*
|
|
6
10
|
* The operation states what it is too, and that is not this. An operation is written without
|
|
7
11
|
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
8
|
-
* operation mounted twice is two tools, and one sentence
|
|
12
|
+
* operation mounted twice is two tools, and one sentence is not true of both.
|
|
9
13
|
*/
|
|
10
14
|
export declare class Tool {
|
|
11
15
|
readonly description: string;
|
|
16
|
+
readonly title: string | undefined;
|
|
12
17
|
constructor(value: unknown, route: string);
|
|
13
18
|
}
|
|
@@ -6,18 +6,29 @@ import { segment } from '../../RTD/segment.js';
|
|
|
6
6
|
* says is what it says it is: a tool a model cannot read the purpose of is one it cannot
|
|
7
7
|
* choose, so there is no way to publish one that states nothing.
|
|
8
8
|
*
|
|
9
|
+
* A `title` is what a person is shown where a client lists what it may call — a name is an
|
|
10
|
+
* address and reads as one. A description alone is written as the value; both are written as
|
|
11
|
+
* a mapping.
|
|
12
|
+
*
|
|
9
13
|
* The operation states what it is too, and that is not this. An operation is written without
|
|
10
14
|
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
11
|
-
* operation mounted twice is two tools, and one sentence
|
|
15
|
+
* operation mounted twice is two tools, and one sentence is not true of both.
|
|
12
16
|
*/
|
|
13
17
|
export class Tool {
|
|
14
18
|
description;
|
|
19
|
+
title;
|
|
15
20
|
constructor(value, route) {
|
|
16
|
-
|
|
21
|
+
const stated = typeof value === 'string' ? { description: value } : value;
|
|
22
|
+
assert.ok(typeof stated === 'object' && stated !== null && !Array.isArray(stated), 'Directive mcp:tool: the value is what the tool is, or a `title` and a `description`');
|
|
23
|
+
const { description, title, ...rest } = stated;
|
|
24
|
+
assert.ok(Object.keys(rest).length === 0, `Directive mcp:tool: unknown ${Object.keys(rest).map((key) => `'${key}'`).join(', ')}`);
|
|
25
|
+
assert.ok(typeof description === 'string' && description.trim().length > 0, 'Directive mcp:tool: a description cannot be empty');
|
|
26
|
+
assert.ok(title === undefined || (typeof title === 'string' && title.trim().length > 0), 'Directive mcp:tool: a title cannot be empty');
|
|
17
27
|
// a tool is called by name, so a route that cannot be named cannot be one — said where
|
|
18
28
|
// the mistake is, rather than as a tool that is quietly never listed
|
|
19
29
|
assert.ok(refusal(segment(route)) === null, `Directive mcp:tool: '${route}' holds a segment no tool name can spell`);
|
|
20
|
-
this.description =
|
|
30
|
+
this.description = description;
|
|
31
|
+
this.title = title;
|
|
21
32
|
}
|
|
22
33
|
}
|
|
23
34
|
//# sourceMappingURL=Tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../../source/directives/mcp/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,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