@frontmcp/plugins 0.6.3 → 0.7.2

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.
Files changed (46) hide show
  1. package/esm/index.mjs +5 -2951
  2. package/esm/package.json +11 -38
  3. package/index.d.ts +16 -4
  4. package/index.d.ts.map +1 -0
  5. package/index.js +9 -2952
  6. package/package.json +11 -38
  7. package/cache/cache.plugin.d.ts +0 -10
  8. package/cache/cache.symbol.d.ts +0 -3
  9. package/cache/cache.types.d.ts +0 -68
  10. package/cache/index.d.ts +0 -2
  11. package/cache/index.js +0 -412
  12. package/cache/providers/cache-memory.provider.d.ts +0 -19
  13. package/cache/providers/cache-redis.provider.d.ts +0 -15
  14. package/cache/providers/cache-vercel-kv.provider.d.ts +0 -24
  15. package/codecall/codecall.plugin.d.ts +0 -41
  16. package/codecall/codecall.symbol.d.ts +0 -106
  17. package/codecall/codecall.types.d.ts +0 -352
  18. package/codecall/errors/index.d.ts +0 -1
  19. package/codecall/errors/tool-call.errors.d.ts +0 -79
  20. package/codecall/index.d.ts +0 -2
  21. package/codecall/index.js +0 -2988
  22. package/codecall/providers/code-call.config.d.ts +0 -29
  23. package/codecall/security/index.d.ts +0 -2
  24. package/codecall/security/self-reference-guard.d.ts +0 -32
  25. package/codecall/security/tool-access-control.service.d.ts +0 -104
  26. package/codecall/services/audit-logger.service.d.ts +0 -186
  27. package/codecall/services/enclave.service.d.ts +0 -62
  28. package/codecall/services/error-enrichment.service.d.ts +0 -94
  29. package/codecall/services/index.d.ts +0 -6
  30. package/codecall/services/output-sanitizer.d.ts +0 -86
  31. package/codecall/services/synonym-expansion.service.d.ts +0 -66
  32. package/codecall/services/tool-search.service.d.ts +0 -175
  33. package/codecall/tools/describe.schema.d.ts +0 -28
  34. package/codecall/tools/describe.tool.d.ts +0 -35
  35. package/codecall/tools/execute.schema.d.ts +0 -115
  36. package/codecall/tools/execute.tool.d.ts +0 -5
  37. package/codecall/tools/index.d.ts +0 -4
  38. package/codecall/tools/invoke.schema.d.ts +0 -104
  39. package/codecall/tools/invoke.tool.d.ts +0 -13
  40. package/codecall/tools/search.schema.d.ts +0 -30
  41. package/codecall/tools/search.tool.d.ts +0 -5
  42. package/codecall/utils/describe.utils.d.ts +0 -86
  43. package/codecall/utils/index.d.ts +0 -2
  44. package/codecall/utils/mcp-result.d.ts +0 -6
  45. package/esm/cache/index.mjs +0 -395
  46. package/esm/codecall/index.mjs +0 -2959
@@ -1,175 +0,0 @@
1
- import { ToolEntry, ScopeEntry } from '@frontmcp/sdk';
2
- import type { EmbeddingStrategy, CodeCallEmbeddingOptions, CodeCallMode } from '../codecall.types';
3
- import type { ToolSearch, ToolSearchResult as SymbolToolSearchResult, ToolSearchOptions as SymbolToolSearchOptions } from '../codecall.symbol';
4
- import { SynonymExpansionConfig } from './synonym-expansion.service';
5
- /**
6
- * Search result for tool search
7
- */
8
- export interface SearchResult {
9
- tool: ToolEntry<any, any>;
10
- score: number;
11
- toolName: string;
12
- qualifiedName: string;
13
- appId?: string;
14
- }
15
- /**
16
- * Search options for tool search
17
- */
18
- export interface SearchOptions {
19
- topK?: number;
20
- appIds?: string[];
21
- excludeToolNames?: string[];
22
- minScore?: number;
23
- }
24
- /**
25
- * Filter function type for including tools
26
- */
27
- export type IncludeToolsFilter = (info: {
28
- name: string;
29
- appId?: string;
30
- source?: string;
31
- description?: string;
32
- tags?: string[];
33
- }) => boolean;
34
- /**
35
- * Configuration for tool search service
36
- */
37
- export interface ToolSearchServiceConfig {
38
- /**
39
- * Embedding strategy to use
40
- * @default 'tfidf'
41
- */
42
- strategy?: EmbeddingStrategy;
43
- /**
44
- * Full embedding options (alternative to just strategy)
45
- */
46
- embeddingOptions?: CodeCallEmbeddingOptions;
47
- /**
48
- * Default number of results to return
49
- * @default 8
50
- */
51
- defaultTopK?: number;
52
- /**
53
- * Default similarity threshold
54
- * @default 0.0
55
- */
56
- defaultSimilarityThreshold?: number;
57
- /**
58
- * CodeCall mode for filtering tools
59
- * @default 'codecall_only'
60
- */
61
- mode?: CodeCallMode;
62
- /**
63
- * Optional filter function for including tools in the search index
64
- */
65
- includeTools?: IncludeToolsFilter;
66
- /**
67
- * Synonym expansion configuration.
68
- * When enabled, queries are expanded with synonyms to improve search relevance.
69
- * For example, "add user" will also match tools containing "create user".
70
- * Only applies when strategy is 'tfidf' (ML already handles semantic similarity).
71
- *
72
- * Set to false to disable, or provide a config object to customize.
73
- * @default { enabled: true } when strategy is 'tfidf'
74
- */
75
- synonymExpansion?: false | (SynonymExpansionConfig & {
76
- enabled?: boolean;
77
- });
78
- }
79
- /**
80
- * Service that maintains a searchable index of tools from the ToolRegistry
81
- * Supports both TF-IDF (lightweight, synchronous) and ML-based (semantic) embeddings
82
- * Implements the ToolSearch interface for dependency injection
83
- */
84
- export declare class ToolSearchService implements ToolSearch {
85
- private static readonly MAX_SUBSCRIPTION_RETRIES;
86
- private vectorDB;
87
- private strategy;
88
- private initialized;
89
- private mlInitialized;
90
- private subscriptionRetries;
91
- private config;
92
- private scope;
93
- private unsubscribe?;
94
- private synonymService;
95
- constructor(config: ToolSearchServiceConfig | undefined, scope: ScopeEntry);
96
- /**
97
- * Sets up subscription to tool changes. Handles the case where scope.tools
98
- * may not be available yet during plugin initialization.
99
- */
100
- private setupSubscription;
101
- /**
102
- * Handles tool change events by reindexing all tools from the snapshot
103
- */
104
- private handleToolChange;
105
- /**
106
- * Determines if a tool should be indexed in the search database.
107
- * Filters based on:
108
- * - Excludes codecall:* meta-tools (they should not be searchable)
109
- * - Mode-based filtering (codecall_only, codecall_opt_in, metadata_driven)
110
- * - Per-tool metadata.codecall.enabledInCodeCall
111
- * - Custom includeTools filter function
112
- */
113
- private shouldIndexTool;
114
- /**
115
- * Extract CodeCall-specific metadata from a tool.
116
- */
117
- private getCodeCallMetadata;
118
- /**
119
- * Initializes the search service by indexing all tools from the registry.
120
- * NOTE: This method is now a no-op. Initialization is handled reactively
121
- * via subscription to tool change events in the constructor.
122
- * This method exists for interface compatibility.
123
- */
124
- initialize(): Promise<void>;
125
- /**
126
- * Cleanup subscription when service is destroyed
127
- */
128
- dispose(): void;
129
- /**
130
- * Extracts searchable text from a tool instance.
131
- * Uses term weighting to improve relevance:
132
- * - Description terms are heavily weighted (most important for semantic matching)
133
- * - Tool name parts are tokenized and weighted
134
- * - Tags provide additional context
135
- */
136
- private extractSearchableText;
137
- /**
138
- * Checks if a word is a common stop word that should not receive extra weighting.
139
- * Uses module-level STOP_WORDS constant to avoid recreating the Set on each call.
140
- */
141
- private isStopWord;
142
- /**
143
- * Extracts app ID from tool's owner lineage
144
- */
145
- private extractAppId;
146
- /**
147
- * Searches for tools matching the query
148
- * Implements the ToolSearch interface
149
- */
150
- search(query: string, options?: SymbolToolSearchOptions): Promise<SymbolToolSearchResult[]>;
151
- /**
152
- * Gets all indexed tool names
153
- */
154
- getAllToolNames(): string[];
155
- /**
156
- * Gets the total number of indexed tools
157
- */
158
- getTotalCount(): number;
159
- /**
160
- * Checks if a tool exists in the index
161
- */
162
- hasTool(toolName: string): boolean;
163
- /**
164
- * Clears the entire index
165
- */
166
- clear(): void;
167
- /**
168
- * Get the current embedding strategy
169
- */
170
- getStrategy(): EmbeddingStrategy;
171
- /**
172
- * Check if the service is initialized
173
- */
174
- isInitialized(): boolean;
175
- }
@@ -1,28 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const describeToolDescription = "Get input/output schemas for tools from search results.\n\nINPUT: toolNames: string[] - tool names from search\nOUTPUT per tool: inputSchema (JSON Schema), outputSchema (JSON Schema), usageExamples (up to 5 callTool examples)\n\nIMPORTANT: If notFound array is non-empty \u2192 re-search with corrected queries.\nFLOW: search \u2192 describe \u2192 execute/invoke";
3
- export declare const describeToolInputSchema: z.ZodObject<{
4
- toolNames: z.ZodArray<z.ZodString>;
5
- }, z.core.$strip>;
6
- export type DescribeToolInput = z.infer<typeof describeToolInputSchema>;
7
- export declare const describeToolOutputSchema: z.ZodObject<{
8
- tools: z.ZodArray<z.ZodObject<{
9
- name: z.ZodString;
10
- appId: z.ZodString;
11
- description: z.ZodString;
12
- inputSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
- outputSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
14
- annotations: z.ZodOptional<z.ZodObject<{
15
- title: z.ZodOptional<z.ZodString>;
16
- readOnlyHint: z.ZodOptional<z.ZodBoolean>;
17
- destructiveHint: z.ZodOptional<z.ZodBoolean>;
18
- idempotentHint: z.ZodOptional<z.ZodBoolean>;
19
- openWorldHint: z.ZodOptional<z.ZodBoolean>;
20
- }, z.core.$strip>>;
21
- usageExamples: z.ZodArray<z.ZodObject<{
22
- description: z.ZodString;
23
- code: z.ZodString;
24
- }, z.core.$strip>>;
25
- }, z.core.$strip>>;
26
- notFound: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
- }, z.core.$strip>;
28
- export type DescribeToolOutput = z.infer<typeof describeToolOutputSchema>;
@@ -1,35 +0,0 @@
1
- import { ToolContext } from '@frontmcp/sdk';
2
- import { DescribeToolInput, DescribeToolOutput } from './describe.schema';
3
- export default class DescribeTool extends ToolContext {
4
- execute(input: DescribeToolInput): Promise<DescribeToolOutput>;
5
- /**
6
- * Get the input schema for a tool, converting from Zod to JSON Schema.
7
- * This ensures that property descriptions from .describe() are included.
8
- *
9
- * Priority:
10
- * 1. Convert from tool.inputSchema (Zod) to get descriptions
11
- * 2. Fall back to rawInputSchema if conversion fails
12
- * 3. Return null if no schema available
13
- */
14
- private getInputSchema;
15
- /**
16
- * Convert a schema to JSON Schema format.
17
- * Handles Zod schemas, raw shapes, and already-JSON-Schema objects.
18
- *
19
- * Uses Zod v4's built-in z.toJSONSchema() for conversion.
20
- */
21
- private toJsonSchema;
22
- /**
23
- * Extract app ID from tool metadata or owner.
24
- */
25
- private extractAppId;
26
- /**
27
- * Generate up to 5 usage examples for a tool.
28
- *
29
- * Priority:
30
- * 1. User-provided examples from @Tool decorator metadata (up to 5)
31
- * 2. Smart intent-based generation to fill remaining slots
32
- * 3. Returns at least 1 example
33
- */
34
- private generateExamples;
35
- }
@@ -1,115 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const executeToolDescription = "Execute AgentScript (safe JS subset) for multi-tool orchestration.\n\nAPI: await callTool(name, args, opts?)\n- Default: throws on error\n- Safe mode: { throwOnError: false } \u2192 returns { success, data?, error? }\n\nEXAMPLE:\nconst users = await callTool('users:list', { active: true });\nconst results = [];\nfor (const u of users.items) {\n const orders = await callTool('orders:list', { userId: u.id });\n results.push({ id: u.id, total: orders.items.reduce((s,o) => s + o.amount, 0) });\n}\nreturn results;\n\nALLOWED: for, for-of, arrow fn, map/filter/reduce/find, Math.*, JSON.*, if/else, destructuring, spread, template literals\nBLOCKED: while, do-while, function decl, eval, require, fetch, setTimeout, process, globalThis\n\nERRORS: NOT_FOUND | VALIDATION | EXECUTION | TIMEOUT | ACCESS_DENIED\nSTATUS: ok | syntax_error | illegal_access | runtime_error | tool_error | timeout\nLIMITS: 10K iter/loop, 30s timeout, 100 calls max";
3
- export declare const executeToolInputSchema: z.ZodObject<{
4
- script: z.ZodString;
5
- allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
- }, z.core.$strip>;
7
- export type ExecuteToolInput = z.infer<typeof executeToolInputSchema>;
8
- /**
9
- * Result variants
10
- */
11
- export declare const codeCallOkResultSchema: z.ZodObject<{
12
- status: z.ZodLiteral<"ok">;
13
- result: z.ZodUnknown;
14
- logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
- }, z.core.$strip>;
16
- export declare const codeCallSyntaxErrorResultSchema: z.ZodObject<{
17
- status: z.ZodLiteral<"syntax_error">;
18
- error: z.ZodObject<{
19
- message: z.ZodString;
20
- location: z.ZodOptional<z.ZodObject<{
21
- line: z.ZodNumber;
22
- column: z.ZodNumber;
23
- }, z.core.$strip>>;
24
- }, z.core.$strip>;
25
- }, z.core.$strip>;
26
- export declare const codeCallIllegalAccessResultSchema: z.ZodObject<{
27
- status: z.ZodLiteral<"illegal_access">;
28
- error: z.ZodObject<{
29
- message: z.ZodString;
30
- kind: z.ZodUnion<readonly [z.ZodLiteral<"IllegalBuiltinAccess">, z.ZodLiteral<"DisallowedGlobal">, z.ZodString]>;
31
- }, z.core.$strip>;
32
- }, z.core.$strip>;
33
- export declare const codeCallRuntimeErrorResultSchema: z.ZodObject<{
34
- status: z.ZodLiteral<"runtime_error">;
35
- error: z.ZodObject<{
36
- source: z.ZodLiteral<"script">;
37
- message: z.ZodString;
38
- name: z.ZodOptional<z.ZodString>;
39
- stack: z.ZodOptional<z.ZodString>;
40
- }, z.core.$strip>;
41
- }, z.core.$strip>;
42
- export declare const codeCallToolErrorResultSchema: z.ZodObject<{
43
- status: z.ZodLiteral<"tool_error">;
44
- error: z.ZodObject<{
45
- source: z.ZodLiteral<"tool">;
46
- toolName: z.ZodString;
47
- toolInput: z.ZodUnknown;
48
- message: z.ZodString;
49
- code: z.ZodOptional<z.ZodString>;
50
- details: z.ZodOptional<z.ZodUnknown>;
51
- }, z.core.$strip>;
52
- }, z.core.$strip>;
53
- export declare const codeCallTimeoutResultSchema: z.ZodObject<{
54
- status: z.ZodLiteral<"timeout">;
55
- error: z.ZodObject<{
56
- message: z.ZodString;
57
- }, z.core.$strip>;
58
- }, z.core.$strip>;
59
- /**
60
- * Discriminated union for the whole result
61
- */
62
- export declare const executeToolOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
- status: z.ZodLiteral<"ok">;
64
- result: z.ZodUnknown;
65
- logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
66
- }, z.core.$strip>, z.ZodObject<{
67
- status: z.ZodLiteral<"syntax_error">;
68
- error: z.ZodObject<{
69
- message: z.ZodString;
70
- location: z.ZodOptional<z.ZodObject<{
71
- line: z.ZodNumber;
72
- column: z.ZodNumber;
73
- }, z.core.$strip>>;
74
- }, z.core.$strip>;
75
- }, z.core.$strip>, z.ZodObject<{
76
- status: z.ZodLiteral<"illegal_access">;
77
- error: z.ZodObject<{
78
- message: z.ZodString;
79
- kind: z.ZodUnion<readonly [z.ZodLiteral<"IllegalBuiltinAccess">, z.ZodLiteral<"DisallowedGlobal">, z.ZodString]>;
80
- }, z.core.$strip>;
81
- }, z.core.$strip>, z.ZodObject<{
82
- status: z.ZodLiteral<"runtime_error">;
83
- error: z.ZodObject<{
84
- source: z.ZodLiteral<"script">;
85
- message: z.ZodString;
86
- name: z.ZodOptional<z.ZodString>;
87
- stack: z.ZodOptional<z.ZodString>;
88
- }, z.core.$strip>;
89
- }, z.core.$strip>, z.ZodObject<{
90
- status: z.ZodLiteral<"tool_error">;
91
- error: z.ZodObject<{
92
- source: z.ZodLiteral<"tool">;
93
- toolName: z.ZodString;
94
- toolInput: z.ZodUnknown;
95
- message: z.ZodString;
96
- code: z.ZodOptional<z.ZodString>;
97
- details: z.ZodOptional<z.ZodUnknown>;
98
- }, z.core.$strip>;
99
- }, z.core.$strip>, z.ZodObject<{
100
- status: z.ZodLiteral<"timeout">;
101
- error: z.ZodObject<{
102
- message: z.ZodString;
103
- }, z.core.$strip>;
104
- }, z.core.$strip>], "status">;
105
- /**
106
- * Inferred types
107
- * (you can export whichever ones you actually need)
108
- */
109
- export type CodeCallOkResult = z.infer<typeof codeCallOkResultSchema>;
110
- export type CodeCallSyntaxErrorResult = z.infer<typeof codeCallSyntaxErrorResultSchema>;
111
- export type CodeCallIllegalAccessResult = z.infer<typeof codeCallIllegalAccessResultSchema>;
112
- export type CodeCallRuntimeErrorResult = z.infer<typeof codeCallRuntimeErrorResultSchema>;
113
- export type CodeCallToolErrorResult = z.infer<typeof codeCallToolErrorResultSchema>;
114
- export type CodeCallTimeoutResult = z.infer<typeof codeCallTimeoutResultSchema>;
115
- export type CodeCallExecuteResult = CodeCallOkResult | CodeCallSyntaxErrorResult | CodeCallIllegalAccessResult | CodeCallRuntimeErrorResult | CodeCallToolErrorResult | CodeCallTimeoutResult;
@@ -1,5 +0,0 @@
1
- import { ToolContext } from '@frontmcp/sdk';
2
- import { CodeCallExecuteResult, ExecuteToolInput } from './execute.schema';
3
- export default class ExecuteTool extends ToolContext {
4
- execute(input: ExecuteToolInput): Promise<CodeCallExecuteResult>;
5
- }
@@ -1,4 +0,0 @@
1
- export { default as SearchTool } from './search.tool';
2
- export { default as DescribeTool } from './describe.tool';
3
- export { default as ExecuteTool } from './execute.tool';
4
- export { default as InvokeTool } from './invoke.tool';
@@ -1,104 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const invokeToolDescription = "Call ONE tool directly. Returns standard MCP CallToolResult.\n\nUSE invoke: single tool, no transformation\nUSE execute: multiple tools, loops, filtering, joining\n\nINPUT: tool (string), input (object matching tool schema)\nOUTPUT: MCP CallToolResult (same as standard tool call)\nERRORS: tool_not_found (\u2192 re-search) | validation_error | execution_error | permission_denied\n\nFLOW: search \u2192 describe \u2192 invoke";
3
- export declare const invokeToolInputSchema: z.ZodObject<{
4
- tool: z.ZodString;
5
- input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6
- }, z.core.$strip>;
7
- export type InvokeToolInput = z.infer<typeof invokeToolInputSchema>;
8
- export declare const invokeToolOutputSchema: z.ZodObject<{
9
- _meta: z.ZodOptional<z.ZodObject<{
10
- progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
11
- "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
12
- taskId: z.ZodString;
13
- }, z.core.$strip>>;
14
- }, z.core.$loose>>;
15
- content: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
16
- type: z.ZodLiteral<"text">;
17
- text: z.ZodString;
18
- annotations: z.ZodOptional<z.ZodObject<{
19
- audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
20
- user: "user";
21
- assistant: "assistant";
22
- }>>>;
23
- priority: z.ZodOptional<z.ZodNumber>;
24
- lastModified: z.ZodOptional<z.ZodISODateTime>;
25
- }, z.core.$strip>>;
26
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
- }, z.core.$strip>, z.ZodObject<{
28
- type: z.ZodLiteral<"image">;
29
- data: z.ZodString;
30
- mimeType: z.ZodString;
31
- annotations: z.ZodOptional<z.ZodObject<{
32
- audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
33
- user: "user";
34
- assistant: "assistant";
35
- }>>>;
36
- priority: z.ZodOptional<z.ZodNumber>;
37
- lastModified: z.ZodOptional<z.ZodISODateTime>;
38
- }, z.core.$strip>>;
39
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
40
- }, z.core.$strip>, z.ZodObject<{
41
- type: z.ZodLiteral<"audio">;
42
- data: z.ZodString;
43
- mimeType: z.ZodString;
44
- annotations: z.ZodOptional<z.ZodObject<{
45
- audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
46
- user: "user";
47
- assistant: "assistant";
48
- }>>>;
49
- priority: z.ZodOptional<z.ZodNumber>;
50
- lastModified: z.ZodOptional<z.ZodISODateTime>;
51
- }, z.core.$strip>>;
52
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
53
- }, z.core.$strip>, z.ZodObject<{
54
- uri: z.ZodString;
55
- description: z.ZodOptional<z.ZodString>;
56
- mimeType: z.ZodOptional<z.ZodString>;
57
- annotations: z.ZodOptional<z.ZodObject<{
58
- audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
59
- user: "user";
60
- assistant: "assistant";
61
- }>>>;
62
- priority: z.ZodOptional<z.ZodNumber>;
63
- lastModified: z.ZodOptional<z.ZodISODateTime>;
64
- }, z.core.$strip>>;
65
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
66
- icons: z.ZodOptional<z.ZodArray<z.ZodObject<{
67
- src: z.ZodString;
68
- mimeType: z.ZodOptional<z.ZodString>;
69
- sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
- theme: z.ZodOptional<z.ZodEnum<{
71
- light: "light";
72
- dark: "dark";
73
- }>>;
74
- }, z.core.$strip>>>;
75
- name: z.ZodString;
76
- title: z.ZodOptional<z.ZodString>;
77
- type: z.ZodLiteral<"resource_link">;
78
- }, z.core.$strip>, z.ZodObject<{
79
- type: z.ZodLiteral<"resource">;
80
- resource: z.ZodUnion<readonly [z.ZodObject<{
81
- uri: z.ZodString;
82
- mimeType: z.ZodOptional<z.ZodString>;
83
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
84
- text: z.ZodString;
85
- }, z.core.$strip>, z.ZodObject<{
86
- uri: z.ZodString;
87
- mimeType: z.ZodOptional<z.ZodString>;
88
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
89
- blob: z.ZodString;
90
- }, z.core.$strip>]>;
91
- annotations: z.ZodOptional<z.ZodObject<{
92
- audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
93
- user: "user";
94
- assistant: "assistant";
95
- }>>>;
96
- priority: z.ZodOptional<z.ZodNumber>;
97
- lastModified: z.ZodOptional<z.ZodISODateTime>;
98
- }, z.core.$strip>>;
99
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
100
- }, z.core.$strip>]>>>;
101
- structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
102
- isError: z.ZodOptional<z.ZodBoolean>;
103
- }, z.core.$loose>;
104
- export type InvokeToolOutput = z.infer<typeof invokeToolOutputSchema>;
@@ -1,13 +0,0 @@
1
- import { ToolContext } from '@frontmcp/sdk';
2
- import { InvokeToolInput, InvokeToolOutput } from './invoke.schema';
3
- /**
4
- * InvokeTool allows direct tool invocation without running JavaScript code.
5
- * Returns the same CallToolResult format as a standard MCP tool call.
6
- *
7
- * Security Considerations:
8
- * - Self-reference blocking: Cannot invoke codecall:* tools
9
- * - All middleware (auth, PII, rate limiting) applies via normal tool execution
10
- */
11
- export default class InvokeTool extends ToolContext {
12
- execute(input: InvokeToolInput): Promise<InvokeToolOutput>;
13
- }
@@ -1,30 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const searchToolDescription = "Find tools by splitting user request into atomic actions.\n\nDECOMPOSE: \"delete users and send email\" \u2192 queries: [\"delete user\", \"send email\"]\nDECOMPOSE: \"get order and refund\" \u2192 queries: [\"get order\", \"calculate refund\"]\n\nAVOID RE-SEARCHING: Use excludeToolNames for already-discovered tools.\nRE-SEARCH WHEN: describe fails (typo?) OR execute returns tool_not_found.\n\nINPUT:\n- queries: string[] (required) - atomic action phrases, max 10\n- appIds?: string[] - filter by app\n- excludeToolNames?: string[] - skip known tools\n- topK?: number (default 5) - results per query\n- minRelevanceScore?: number (default 0.3) - minimum match threshold\n\nOUTPUT: Flat deduplicated tool list. relevanceScore: 0.5+=good, 0.7+=strong match.\n\nFLOW: search \u2192 describe \u2192 execute/invoke";
3
- export declare const searchToolInputSchema: z.ZodObject<{
4
- queries: z.ZodArray<z.ZodString>;
5
- appIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
- excludeToolNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
- topK: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
8
- minRelevanceScore: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
9
- }, z.core.$strip>;
10
- export type SearchToolInput = z.infer<typeof searchToolInputSchema>;
11
- export declare const searchToolOutputSchema: z.ZodObject<{
12
- tools: z.ZodArray<z.ZodObject<{
13
- name: z.ZodString;
14
- appId: z.ZodOptional<z.ZodString>;
15
- description: z.ZodString;
16
- relevanceScore: z.ZodNumber;
17
- matchedQueries: z.ZodArray<z.ZodString>;
18
- }, z.core.$strip>>;
19
- warnings: z.ZodArray<z.ZodObject<{
20
- type: z.ZodEnum<{
21
- excluded_tool_not_found: "excluded_tool_not_found";
22
- no_results: "no_results";
23
- low_relevance: "low_relevance";
24
- }>;
25
- message: z.ZodString;
26
- affectedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
- }, z.core.$strip>>;
28
- totalAvailableTools: z.ZodNumber;
29
- }, z.core.$strip>;
30
- export type SearchToolOutput = z.infer<typeof searchToolOutputSchema>;
@@ -1,5 +0,0 @@
1
- import { ToolContext } from '@frontmcp/sdk';
2
- import { SearchToolInput, SearchToolOutput } from './search.schema';
3
- export default class SearchTool extends ToolContext {
4
- execute(input: SearchToolInput): Promise<SearchToolOutput>;
5
- }
@@ -1,86 +0,0 @@
1
- import type { JSONSchema } from 'zod/v4/core';
2
- /** JSON Schema type from Zod v4 */
3
- type JsonSchema = JSONSchema.JSONSchema;
4
- /**
5
- * Tool example for describe output
6
- */
7
- export interface ToolUsageExample {
8
- description: string;
9
- code: string;
10
- }
11
- /**
12
- * Detected intent of a tool based on its name and description.
13
- */
14
- export type ToolIntent = 'create' | 'list' | 'get' | 'update' | 'delete' | 'search' | 'action' | 'unknown';
15
- /**
16
- * Detect the intent of a tool from its name.
17
- * Extracts the action verb from tool names like "users:create" or "orders:list".
18
- */
19
- export declare function detectToolIntent(toolName: string, description?: string): ToolIntent;
20
- /**
21
- * Generate a TypeScript-like function signature from a JSON Schema.
22
- *
23
- * @example
24
- * Input: { type: 'object', properties: { id: { type: 'string' }, limit: { type: 'number' } }, required: ['id'] }
25
- * Output: "(id: string, limit?: number) => unknown"
26
- */
27
- export declare function jsonSchemaToSignature(toolName: string, inputSchema?: JsonSchema, outputSchema?: JsonSchema): string;
28
- /**
29
- * Generate a natural language summary of a schema.
30
- */
31
- export declare function jsonSchemaToNaturalLanguage(schema: JsonSchema | undefined | null, direction: 'input' | 'output'): string;
32
- /**
33
- * Generate a basic usage example for a tool.
34
- */
35
- export declare function generateBasicExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
36
- /**
37
- * Check if a schema has pagination parameters.
38
- */
39
- export declare function hasPaginationParams(schema?: JsonSchema): boolean;
40
- /**
41
- * Check if a schema has filter-like parameters.
42
- */
43
- export declare function hasFilterParams(schema?: JsonSchema): boolean;
44
- /**
45
- * Get filter-like property names from a schema.
46
- */
47
- export declare function getFilterProperties(schema?: JsonSchema): string[];
48
- /**
49
- * Generate a pagination example for a tool.
50
- */
51
- export declare function generatePaginationExample(toolName: string): ToolUsageExample;
52
- /**
53
- * Generate a filter example for a tool.
54
- */
55
- export declare function generateFilterExample(toolName: string, filterProp: string): ToolUsageExample;
56
- /**
57
- * Generate a create example for a tool.
58
- * Shows required parameters with contextual sample values.
59
- */
60
- export declare function generateCreateExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
61
- /**
62
- * Generate a get (retrieve single item) example for a tool.
63
- */
64
- export declare function generateGetExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
65
- /**
66
- * Generate a list example for a tool.
67
- */
68
- export declare function generateListExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
69
- /**
70
- * Generate an update example for a tool.
71
- */
72
- export declare function generateUpdateExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
73
- /**
74
- * Generate a delete example for a tool.
75
- */
76
- export declare function generateDeleteExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
77
- /**
78
- * Generate a search example for a tool.
79
- */
80
- export declare function generateSearchExample(toolName: string, inputSchema?: JsonSchema): ToolUsageExample;
81
- /**
82
- * Smart example generator that uses intent detection.
83
- * This is the main entry point for generating examples.
84
- */
85
- export declare function generateSmartExample(toolName: string, inputSchema?: JsonSchema, description?: string): ToolUsageExample;
86
- export {};
@@ -1,2 +0,0 @@
1
- export * from './describe.utils';
2
- export * from './mcp-result';
@@ -1,6 +0,0 @@
1
- import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
- /**
3
- * Extract the actual result from a CallToolResult.
4
- * MCP returns results wrapped in content array format.
5
- */
6
- export declare function extractResultFromCallToolResult(mcpResult: CallToolResult): unknown;