@hiveforge/hivemind-mcp 3.4.0 → 3.5.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/README.md +89 -309
- package/dist/cli/fix/fixer.js +1 -1
- package/dist/cli/fix/fixer.js.map +1 -1
- package/dist/cli/fix/writer.d.ts.map +1 -1
- package/dist/cli/fix/writer.js +75 -3
- package/dist/cli/fix/writer.js.map +1 -1
- package/dist/cli/init/output.d.ts.map +1 -1
- package/dist/cli/init/output.js +6 -5
- package/dist/cli/init/output.js.map +1 -1
- package/dist/cli/validate/formatter.d.ts.map +1 -1
- package/dist/cli/validate/formatter.js +16 -0
- package/dist/cli/validate/formatter.js.map +1 -1
- package/dist/cli/validate/types.d.ts +3 -0
- package/dist/cli/validate/types.d.ts.map +1 -1
- package/dist/cli/validate/validator.d.ts.map +1 -1
- package/dist/cli/validate/validator.js +32 -1
- package/dist/cli/validate/validator.js.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/graph/database.d.ts +152 -0
- package/dist/graph/database.d.ts.map +1 -1
- package/dist/graph/database.js +418 -30
- package/dist/graph/database.js.map +1 -1
- package/dist/mcp/graph-tools.d.ts +78 -0
- package/dist/mcp/graph-tools.d.ts.map +1 -0
- package/dist/mcp/graph-tools.js +284 -0
- package/dist/mcp/graph-tools.js.map +1 -0
- package/dist/mcp/timeline-tools.d.ts +116 -0
- package/dist/mcp/timeline-tools.d.ts.map +1 -0
- package/dist/mcp/timeline-tools.js +317 -0
- package/dist/mcp/timeline-tools.js.map +1 -0
- package/dist/search/engine.d.ts +186 -0
- package/dist/search/engine.d.ts.map +1 -1
- package/dist/search/engine.js +263 -0
- package/dist/search/engine.js.map +1 -1
- package/dist/server.d.ts +52 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +472 -0
- package/dist/server.js.map +1 -1
- package/dist/templates/builtin/worldbuilding.d.ts.map +1 -1
- package/dist/templates/builtin/worldbuilding.js +401 -1
- package/dist/templates/builtin/worldbuilding.js.map +1 -1
- package/dist/templates/community/dnd-35e.d.ts +18 -0
- package/dist/templates/community/dnd-35e.d.ts.map +1 -0
- package/dist/templates/community/dnd-35e.js +859 -0
- package/dist/templates/community/dnd-35e.js.map +1 -0
- package/dist/templates/community/dnd-5e.d.ts +16 -0
- package/dist/templates/community/dnd-5e.d.ts.map +1 -0
- package/dist/templates/community/dnd-5e.js +509 -0
- package/dist/templates/community/dnd-5e.js.map +1 -0
- package/dist/templates/community/index.d.ts +9 -0
- package/dist/templates/community/index.d.ts.map +1 -1
- package/dist/templates/community/index.js +16 -0
- package/dist/templates/community/index.js.map +1 -1
- package/dist/templates/community/pathfinder-2e.d.ts +16 -0
- package/dist/templates/community/pathfinder-2e.d.ts.map +1 -0
- package/dist/templates/community/pathfinder-2e.js +711 -0
- package/dist/templates/community/pathfinder-2e.js.map +1 -0
- package/dist/templates/community/ttrpg-base.d.ts +17 -0
- package/dist/templates/community/ttrpg-base.d.ts.map +1 -0
- package/dist/templates/community/ttrpg-base.js +889 -0
- package/dist/templates/community/ttrpg-base.js.map +1 -0
- package/dist/templates/loader.d.ts +2 -0
- package/dist/templates/loader.d.ts.map +1 -1
- package/dist/templates/loader.js +45 -1
- package/dist/templates/loader.js.map +1 -1
- package/dist/templates/registry.d.ts +49 -2
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +276 -6
- package/dist/templates/registry.js.map +1 -1
- package/dist/templates/types.d.ts +28 -1
- package/dist/templates/types.d.ts.map +1 -1
- package/dist/templates/validator.d.ts +80 -1
- package/dist/templates/validator.d.ts.map +1 -1
- package/dist/templates/validator.js +22 -5
- package/dist/templates/validator.js.map +1 -1
- package/dist/types/index.d.ts +18 -18
- package/package.json +1 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph MCP tools - relationship traversal and path finding.
|
|
3
|
+
*
|
|
4
|
+
* Provides graph traversal tools for querying entity relationships,
|
|
5
|
+
* finding shortest paths, and discovering available relationship types.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { templateRegistry } from '../templates/registry.js';
|
|
9
|
+
/**
|
|
10
|
+
* Validation schema for query_graph_neighbors arguments.
|
|
11
|
+
*
|
|
12
|
+
* Finds immediate neighbors (1-hop connections) of an entity.
|
|
13
|
+
*/
|
|
14
|
+
export const QueryGraphNeighborsArgsSchema = z.object({
|
|
15
|
+
entityId: z
|
|
16
|
+
.string()
|
|
17
|
+
.describe('Entity identifier (ID, name, or Type:name format)'),
|
|
18
|
+
direction: z
|
|
19
|
+
.enum(['outgoing', 'incoming', 'both'])
|
|
20
|
+
.optional()
|
|
21
|
+
.default('both')
|
|
22
|
+
.describe('Traversal direction (default: both)'),
|
|
23
|
+
includeRelationships: z
|
|
24
|
+
.array(z.string())
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Only include these relationship types'),
|
|
27
|
+
excludeRelationships: z
|
|
28
|
+
.array(z.string())
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Exclude these relationship types'),
|
|
31
|
+
includeEntityTypes: z
|
|
32
|
+
.array(z.string())
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Only return neighbors of these entity types'),
|
|
35
|
+
limit: z
|
|
36
|
+
.number()
|
|
37
|
+
.min(1)
|
|
38
|
+
.max(100)
|
|
39
|
+
.optional()
|
|
40
|
+
.default(50)
|
|
41
|
+
.describe('Maximum neighbors to return'),
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Validation schema for query_graph_subgraph arguments.
|
|
45
|
+
*
|
|
46
|
+
* Finds entities within N hops of a starting entity.
|
|
47
|
+
*/
|
|
48
|
+
export const QueryGraphSubgraphArgsSchema = z.object({
|
|
49
|
+
entityId: z
|
|
50
|
+
.string()
|
|
51
|
+
.describe('Starting entity identifier'),
|
|
52
|
+
depth: z
|
|
53
|
+
.number()
|
|
54
|
+
.min(1)
|
|
55
|
+
.max(5)
|
|
56
|
+
.optional()
|
|
57
|
+
.default(2)
|
|
58
|
+
.describe('Number of hops to traverse (max: 5)'),
|
|
59
|
+
direction: z
|
|
60
|
+
.enum(['outgoing', 'incoming', 'both'])
|
|
61
|
+
.optional()
|
|
62
|
+
.default('both')
|
|
63
|
+
.describe('Traversal direction (default: both)'),
|
|
64
|
+
includeRelationships: z
|
|
65
|
+
.array(z.string())
|
|
66
|
+
.optional()
|
|
67
|
+
.describe('Only include these relationship types'),
|
|
68
|
+
excludeRelationships: z
|
|
69
|
+
.array(z.string())
|
|
70
|
+
.optional()
|
|
71
|
+
.describe('Exclude these relationship types'),
|
|
72
|
+
includeEntityTypes: z
|
|
73
|
+
.array(z.string())
|
|
74
|
+
.optional()
|
|
75
|
+
.describe('Only return entities of these types'),
|
|
76
|
+
includeIntermediateNodes: z
|
|
77
|
+
.boolean()
|
|
78
|
+
.optional()
|
|
79
|
+
.default(false)
|
|
80
|
+
.describe('Include nodes at intermediate depths'),
|
|
81
|
+
limit: z
|
|
82
|
+
.number()
|
|
83
|
+
.min(1)
|
|
84
|
+
.max(200)
|
|
85
|
+
.optional()
|
|
86
|
+
.default(100)
|
|
87
|
+
.describe('Maximum entities to return'),
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* Validation schema for query_graph_path arguments.
|
|
91
|
+
*
|
|
92
|
+
* Finds the shortest path between two entities.
|
|
93
|
+
*/
|
|
94
|
+
export const QueryGraphPathArgsSchema = z.object({
|
|
95
|
+
fromEntityId: z
|
|
96
|
+
.string()
|
|
97
|
+
.describe('Starting entity identifier'),
|
|
98
|
+
toEntityId: z
|
|
99
|
+
.string()
|
|
100
|
+
.describe('Target entity identifier'),
|
|
101
|
+
includeRelationships: z
|
|
102
|
+
.array(z.string())
|
|
103
|
+
.optional()
|
|
104
|
+
.describe('Only traverse these relationship types'),
|
|
105
|
+
maxDepth: z
|
|
106
|
+
.number()
|
|
107
|
+
.min(1)
|
|
108
|
+
.max(10)
|
|
109
|
+
.optional()
|
|
110
|
+
.default(6)
|
|
111
|
+
.describe('Maximum path length to search'),
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* Validation schema for list_relationship_types arguments.
|
|
115
|
+
*
|
|
116
|
+
* Lists all relationship types available in the vault.
|
|
117
|
+
*/
|
|
118
|
+
export const ListRelationshipTypesArgsSchema = z.object({
|
|
119
|
+
// No required parameters
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* Generates MCP tool definitions for graph queries.
|
|
123
|
+
*
|
|
124
|
+
* Creates four tools: query_graph_neighbors, query_graph_subgraph,
|
|
125
|
+
* query_graph_path, and list_relationship_types.
|
|
126
|
+
*
|
|
127
|
+
* Tool descriptions dynamically include available relationship types
|
|
128
|
+
* when an active template is present.
|
|
129
|
+
*
|
|
130
|
+
* @returns Array of tool definitions for MCP registration
|
|
131
|
+
*/
|
|
132
|
+
export function generateGraphTools() {
|
|
133
|
+
// Get available relationship types for tool descriptions
|
|
134
|
+
let relationshipTypesDescription = '';
|
|
135
|
+
try {
|
|
136
|
+
const relTypes = templateRegistry.getRelationshipTypes();
|
|
137
|
+
if (relTypes.length > 0) {
|
|
138
|
+
relationshipTypesDescription =
|
|
139
|
+
'\n\nAvailable relationship types: ' +
|
|
140
|
+
relTypes.map((r) => r.id).join(', ');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// No active template - tools still available but without relationship type hints
|
|
145
|
+
}
|
|
146
|
+
return [
|
|
147
|
+
{
|
|
148
|
+
name: 'query_graph_neighbors',
|
|
149
|
+
description: `Get immediate neighbors (1-hop connections) of an entity. Returns neighbor entities with their relationship types and directions.${relationshipTypesDescription}`,
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: 'object',
|
|
152
|
+
properties: {
|
|
153
|
+
entityId: {
|
|
154
|
+
type: 'string',
|
|
155
|
+
description: 'Entity identifier (ID, name, or Type:name format like "Character:john")',
|
|
156
|
+
},
|
|
157
|
+
direction: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
enum: ['outgoing', 'incoming', 'both'],
|
|
160
|
+
default: 'both',
|
|
161
|
+
description: 'Traversal direction (default: both)',
|
|
162
|
+
},
|
|
163
|
+
includeRelationships: {
|
|
164
|
+
type: 'array',
|
|
165
|
+
items: { type: 'string' },
|
|
166
|
+
description: 'Only include these relationship types',
|
|
167
|
+
},
|
|
168
|
+
excludeRelationships: {
|
|
169
|
+
type: 'array',
|
|
170
|
+
items: { type: 'string' },
|
|
171
|
+
description: 'Exclude these relationship types',
|
|
172
|
+
},
|
|
173
|
+
includeEntityTypes: {
|
|
174
|
+
type: 'array',
|
|
175
|
+
items: { type: 'string' },
|
|
176
|
+
description: 'Only return neighbors of these entity types',
|
|
177
|
+
},
|
|
178
|
+
limit: {
|
|
179
|
+
type: 'number',
|
|
180
|
+
minimum: 1,
|
|
181
|
+
maximum: 100,
|
|
182
|
+
default: 50,
|
|
183
|
+
description: 'Maximum neighbors to return',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
required: ['entityId'],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'query_graph_subgraph',
|
|
191
|
+
description: `Get entities within N hops of a starting entity. Useful for exploring the neighborhood around an entity.${relationshipTypesDescription}`,
|
|
192
|
+
inputSchema: {
|
|
193
|
+
type: 'object',
|
|
194
|
+
properties: {
|
|
195
|
+
entityId: {
|
|
196
|
+
type: 'string',
|
|
197
|
+
description: 'Starting entity identifier',
|
|
198
|
+
},
|
|
199
|
+
depth: {
|
|
200
|
+
type: 'number',
|
|
201
|
+
minimum: 1,
|
|
202
|
+
maximum: 5,
|
|
203
|
+
default: 2,
|
|
204
|
+
description: 'Number of hops to traverse (1-5, default: 2)',
|
|
205
|
+
},
|
|
206
|
+
direction: {
|
|
207
|
+
type: 'string',
|
|
208
|
+
enum: ['outgoing', 'incoming', 'both'],
|
|
209
|
+
default: 'both',
|
|
210
|
+
description: 'Traversal direction (default: both)',
|
|
211
|
+
},
|
|
212
|
+
includeRelationships: {
|
|
213
|
+
type: 'array',
|
|
214
|
+
items: { type: 'string' },
|
|
215
|
+
description: 'Only include these relationship types',
|
|
216
|
+
},
|
|
217
|
+
excludeRelationships: {
|
|
218
|
+
type: 'array',
|
|
219
|
+
items: { type: 'string' },
|
|
220
|
+
description: 'Exclude these relationship types',
|
|
221
|
+
},
|
|
222
|
+
includeEntityTypes: {
|
|
223
|
+
type: 'array',
|
|
224
|
+
items: { type: 'string' },
|
|
225
|
+
description: 'Only return entities of these types',
|
|
226
|
+
},
|
|
227
|
+
includeIntermediateNodes: {
|
|
228
|
+
type: 'boolean',
|
|
229
|
+
default: false,
|
|
230
|
+
description: 'Include nodes at intermediate depths (default: only final depth)',
|
|
231
|
+
},
|
|
232
|
+
limit: {
|
|
233
|
+
type: 'number',
|
|
234
|
+
minimum: 1,
|
|
235
|
+
maximum: 200,
|
|
236
|
+
default: 100,
|
|
237
|
+
description: 'Maximum entities to return',
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
required: ['entityId'],
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: 'query_graph_path',
|
|
245
|
+
description: `Find shortest path between two entities. Returns both the node sequence and edge list.${relationshipTypesDescription}`,
|
|
246
|
+
inputSchema: {
|
|
247
|
+
type: 'object',
|
|
248
|
+
properties: {
|
|
249
|
+
fromEntityId: {
|
|
250
|
+
type: 'string',
|
|
251
|
+
description: 'Starting entity identifier',
|
|
252
|
+
},
|
|
253
|
+
toEntityId: {
|
|
254
|
+
type: 'string',
|
|
255
|
+
description: 'Target entity identifier',
|
|
256
|
+
},
|
|
257
|
+
includeRelationships: {
|
|
258
|
+
type: 'array',
|
|
259
|
+
items: { type: 'string' },
|
|
260
|
+
description: 'Only traverse these relationship types',
|
|
261
|
+
},
|
|
262
|
+
maxDepth: {
|
|
263
|
+
type: 'number',
|
|
264
|
+
minimum: 1,
|
|
265
|
+
maximum: 10,
|
|
266
|
+
default: 6,
|
|
267
|
+
description: 'Maximum path length to search',
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
required: ['fromEntityId', 'toEntityId'],
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: 'list_relationship_types',
|
|
275
|
+
description: 'List all relationship types available in the vault. Use this to discover valid filter values for graph queries.',
|
|
276
|
+
inputSchema: {
|
|
277
|
+
type: 'object',
|
|
278
|
+
properties: {},
|
|
279
|
+
required: [],
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
];
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=graph-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-tools.js","sourceRoot":"","sources":["../../src/mcp/graph-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,mDAAmD,CAAC;IAChE,SAAS,EAAE,CAAC;SACT,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;SACtC,QAAQ,EAAE;SACV,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,qCAAqC,CAAC;IAClD,oBAAoB,EAAE,CAAC;SACpB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,uCAAuC,CAAC;IACpD,oBAAoB,EAAE,CAAC;SACpB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,kCAAkC,CAAC;IAC/C,kBAAkB,EAAE,CAAC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AAE,QAAQ;gBACd,UAAU,EAAE;oBACV,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,4BAA4B;qBAC1C;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,0BAA0B;qBACxC;oBACD,oBAAoB,EAAE;wBACpB,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACzB,WAAW,EAAE,wCAAwC;qBACtD;oBACD,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,CAAC;wBACV,OAAO,EAAE,EAAE;wBACX,OAAO,EAAE,CAAC;wBACV,WAAW,EAAE,+BAA+B;qBAC7C;iBACF;gBACD,QAAQ,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC;aACzC;SACF;QACD;YACE,IAAI,EAAE,yBAAyB;YAC/B,WAAW,EACT,iHAAiH;YACnH,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,EAAE;gBACd,QAAQ,EAAE,EAAE;aACb;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeline MCP tools - date field discovery and validation.
|
|
3
|
+
*
|
|
4
|
+
* Provides date field discovery from template registry and Zod validation
|
|
5
|
+
* schemas for timeline query tools.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import type { ToolDefinition } from './tool-generator.js';
|
|
9
|
+
/**
|
|
10
|
+
* Information about an entity type's date fields.
|
|
11
|
+
*/
|
|
12
|
+
export interface TemporalTypeInfo {
|
|
13
|
+
/** Entity type name */
|
|
14
|
+
entityType: string;
|
|
15
|
+
/** Date fields available on this entity type */
|
|
16
|
+
dateFields: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
required: boolean;
|
|
19
|
+
description?: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Discovers entity types that have date-typed fields.
|
|
24
|
+
*
|
|
25
|
+
* Scans the active template's entity types and returns information about
|
|
26
|
+
* which types have date fields available for timeline queries.
|
|
27
|
+
*
|
|
28
|
+
* @returns Array of temporal type information, or empty array if no active template
|
|
29
|
+
*/
|
|
30
|
+
export declare function discoverTemporalTypes(): TemporalTypeInfo[];
|
|
31
|
+
/**
|
|
32
|
+
* Validates that a field exists on an entity type and is a date type.
|
|
33
|
+
*
|
|
34
|
+
* @param entityType - Entity type name to check
|
|
35
|
+
* @param dateField - Field name to validate
|
|
36
|
+
* @returns True if the field exists and is a date type, false otherwise
|
|
37
|
+
*/
|
|
38
|
+
export declare function validateDateField(entityType: string, dateField: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Validation schema for query_timeline_range arguments.
|
|
41
|
+
*
|
|
42
|
+
* Finds entities with date fields in a specified range.
|
|
43
|
+
*/
|
|
44
|
+
export declare const QueryTimelineRangeArgsSchema: z.ZodObject<{
|
|
45
|
+
startDate: z.ZodString;
|
|
46
|
+
endDate: z.ZodString;
|
|
47
|
+
dateField: z.ZodString;
|
|
48
|
+
entityType: z.ZodOptional<z.ZodString>;
|
|
49
|
+
sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
asc: "asc";
|
|
51
|
+
desc: "desc";
|
|
52
|
+
}>>>;
|
|
53
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type QueryTimelineRangeArgs = z.infer<typeof QueryTimelineRangeArgsSchema>;
|
|
56
|
+
/**
|
|
57
|
+
* Validation schema for query_timeline_before arguments.
|
|
58
|
+
*
|
|
59
|
+
* Finds entities with date fields before a specified date.
|
|
60
|
+
*/
|
|
61
|
+
export declare const QueryTimelineBeforeArgsSchema: z.ZodObject<{
|
|
62
|
+
date: z.ZodString;
|
|
63
|
+
dateField: z.ZodString;
|
|
64
|
+
entityType: z.ZodOptional<z.ZodString>;
|
|
65
|
+
sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
66
|
+
asc: "asc";
|
|
67
|
+
desc: "desc";
|
|
68
|
+
}>>>;
|
|
69
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
export type QueryTimelineBeforeArgs = z.infer<typeof QueryTimelineBeforeArgsSchema>;
|
|
72
|
+
/**
|
|
73
|
+
* Validation schema for query_timeline_after arguments.
|
|
74
|
+
*
|
|
75
|
+
* Finds entities with date fields after a specified date.
|
|
76
|
+
*/
|
|
77
|
+
export declare const QueryTimelineAfterArgsSchema: z.ZodObject<{
|
|
78
|
+
date: z.ZodString;
|
|
79
|
+
dateField: z.ZodString;
|
|
80
|
+
entityType: z.ZodOptional<z.ZodString>;
|
|
81
|
+
sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
asc: "asc";
|
|
83
|
+
desc: "desc";
|
|
84
|
+
}>>>;
|
|
85
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export type QueryTimelineAfterArgs = z.infer<typeof QueryTimelineAfterArgsSchema>;
|
|
88
|
+
/**
|
|
89
|
+
* Validation schema for query_timeline_exact arguments.
|
|
90
|
+
*
|
|
91
|
+
* Finds entities with date fields matching an exact date.
|
|
92
|
+
*/
|
|
93
|
+
export declare const QueryTimelineExactArgsSchema: z.ZodObject<{
|
|
94
|
+
date: z.ZodString;
|
|
95
|
+
dateField: z.ZodString;
|
|
96
|
+
entityType: z.ZodOptional<z.ZodString>;
|
|
97
|
+
sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
asc: "asc";
|
|
99
|
+
desc: "desc";
|
|
100
|
+
}>>>;
|
|
101
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export type QueryTimelineExactArgs = z.infer<typeof QueryTimelineExactArgsSchema>;
|
|
104
|
+
/**
|
|
105
|
+
* Generates MCP tool definitions for timeline queries.
|
|
106
|
+
*
|
|
107
|
+
* Creates four tools: query_timeline_range, query_timeline_before,
|
|
108
|
+
* query_timeline_after, and query_timeline_exact.
|
|
109
|
+
*
|
|
110
|
+
* Tool descriptions dynamically include available date fields per entity type.
|
|
111
|
+
*
|
|
112
|
+
* @param temporalTypes - Entity types with date fields
|
|
113
|
+
* @returns Array of tool definitions for MCP registration
|
|
114
|
+
*/
|
|
115
|
+
export declare function generateTimelineTools(temporalTypes: TemporalTypeInfo[]): ToolDefinition[];
|
|
116
|
+
//# sourceMappingURL=timeline-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline-tools.d.ts","sourceRoot":"","sources":["../../src/mcp/timeline-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,EAAE,CA0B1D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAiBhF;AAUD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;iBAwBvC,CAAC;AAEH,MAAM,MAAM,sBAAs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