@frontmcp/plugin-codecall 0.0.1 → 0.7.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/codecall.plugin.d.ts +42 -0
- package/codecall.plugin.d.ts.map +1 -0
- package/codecall.symbol.d.ts +107 -0
- package/codecall.symbol.d.ts.map +1 -0
- package/codecall.types.d.ts +353 -0
- package/codecall.types.d.ts.map +1 -0
- package/errors/index.d.ts +2 -0
- package/errors/index.d.ts.map +1 -0
- package/errors/tool-call.errors.d.ts +80 -0
- package/errors/tool-call.errors.d.ts.map +1 -0
- package/esm/index.mjs +2625 -0
- package/esm/package.json +59 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +2668 -0
- package/package.json +1 -1
- package/providers/code-call.config.d.ts +30 -0
- package/providers/code-call.config.d.ts.map +1 -0
- package/security/index.d.ts +3 -0
- package/security/index.d.ts.map +1 -0
- package/security/self-reference-guard.d.ts +33 -0
- package/security/self-reference-guard.d.ts.map +1 -0
- package/security/tool-access-control.service.d.ts +105 -0
- package/security/tool-access-control.service.d.ts.map +1 -0
- package/services/audit-logger.service.d.ts +187 -0
- package/services/audit-logger.service.d.ts.map +1 -0
- package/services/enclave.service.d.ts +63 -0
- package/services/enclave.service.d.ts.map +1 -0
- package/services/error-enrichment.service.d.ts +95 -0
- package/services/error-enrichment.service.d.ts.map +1 -0
- package/services/index.d.ts +7 -0
- package/services/index.d.ts.map +1 -0
- package/services/output-sanitizer.d.ts +87 -0
- package/services/output-sanitizer.d.ts.map +1 -0
- package/services/synonym-expansion.service.d.ts +67 -0
- package/services/synonym-expansion.service.d.ts.map +1 -0
- package/services/tool-search.service.d.ts +196 -0
- package/services/tool-search.service.d.ts.map +1 -0
- package/tools/describe.schema.d.ts +29 -0
- package/tools/describe.schema.d.ts.map +1 -0
- package/tools/describe.tool.d.ts +36 -0
- package/tools/describe.tool.d.ts.map +1 -0
- package/tools/execute.schema.d.ts +116 -0
- package/tools/execute.schema.d.ts.map +1 -0
- package/tools/execute.tool.d.ts +6 -0
- package/tools/execute.tool.d.ts.map +1 -0
- package/tools/index.d.ts +5 -0
- package/tools/index.d.ts.map +1 -0
- package/tools/invoke.schema.d.ts +105 -0
- package/tools/invoke.schema.d.ts.map +1 -0
- package/tools/invoke.tool.d.ts +14 -0
- package/tools/invoke.tool.d.ts.map +1 -0
- package/tools/search.schema.d.ts +31 -0
- package/tools/search.schema.d.ts.map +1 -0
- package/tools/search.tool.d.ts +6 -0
- package/tools/search.tool.d.ts.map +1 -0
- package/utils/describe.utils.d.ts +87 -0
- package/utils/describe.utils.d.ts.map +1 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.d.ts.map +1 -0
- package/utils/mcp-result.d.ts +7 -0
- package/utils/mcp-result.d.ts.map +1 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the SynonymExpansionService
|
|
3
|
+
*/
|
|
4
|
+
export interface SynonymExpansionConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Additional synonym groups to include beyond defaults.
|
|
7
|
+
* Each group is an array of related terms.
|
|
8
|
+
*/
|
|
9
|
+
additionalSynonyms?: ReadonlyArray<ReadonlyArray<string>>;
|
|
10
|
+
/**
|
|
11
|
+
* If true, completely replace default synonyms with additionalSynonyms.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
replaceDefaults?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum number of expanded terms per input term.
|
|
17
|
+
* Prevents query explosion.
|
|
18
|
+
* @default 5
|
|
19
|
+
*/
|
|
20
|
+
maxExpansionsPerTerm?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Lightweight synonym expansion service for improving TF-IDF search relevance.
|
|
24
|
+
* Zero dependencies, synchronous, and easily extensible.
|
|
25
|
+
*
|
|
26
|
+
* This service provides query-time synonym expansion to help TF-IDF-based
|
|
27
|
+
* search understand that semantically similar terms (like "add" and "create")
|
|
28
|
+
* should match the same tools.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SynonymExpansionService {
|
|
31
|
+
private synonymMap;
|
|
32
|
+
private maxExpansions;
|
|
33
|
+
constructor(config?: SynonymExpansionConfig);
|
|
34
|
+
/**
|
|
35
|
+
* Build a bidirectional synonym map from groups.
|
|
36
|
+
* Each term maps to all other terms in its group(s).
|
|
37
|
+
*/
|
|
38
|
+
private buildSynonymMap;
|
|
39
|
+
/**
|
|
40
|
+
* Get synonyms for a single term.
|
|
41
|
+
* Returns empty array if no synonyms found.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* getSynonyms('add') // ['create', 'new', 'insert', 'make']
|
|
45
|
+
*/
|
|
46
|
+
getSynonyms(term: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Expand a query string by adding synonyms for each term.
|
|
49
|
+
* Returns the expanded query string with original terms and their synonyms.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* expandQuery('add user') // 'add create new insert make user account member profile'
|
|
53
|
+
*/
|
|
54
|
+
expandQuery(query: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Check if synonym expansion is available for any term in the query.
|
|
57
|
+
*/
|
|
58
|
+
hasExpansions(query: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Get statistics about the synonym dictionary.
|
|
61
|
+
*/
|
|
62
|
+
getStats(): {
|
|
63
|
+
termCount: number;
|
|
64
|
+
avgSynonymsPerTerm: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=synonym-expansion.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synonym-expansion.service.d.ts","sourceRoot":"","sources":["../../src/services/synonym-expansion.service.ts"],"names":[],"mappings":"AAoTA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1D;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,aAAa,CAAS;gBAElB,MAAM,GAAE,sBAA2B;IAW/C;;;OAGG;IACH,OAAO,CAAC,eAAe;IAwBvB;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;IAYnC;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAoBlC;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAKrC;;OAEG;IACH,QAAQ,IAAI;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE;CAa9D"}
|
|
@@ -0,0 +1,196 @@
|
|
|
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 static readonly INITIAL_RETRY_DELAY_MS;
|
|
87
|
+
private static readonly MAX_RETRY_DELAY_MS;
|
|
88
|
+
private vectorDB;
|
|
89
|
+
private strategy;
|
|
90
|
+
private initialized;
|
|
91
|
+
private mlInitialized;
|
|
92
|
+
private config;
|
|
93
|
+
private scope;
|
|
94
|
+
private unsubscribe?;
|
|
95
|
+
private synonymService;
|
|
96
|
+
private subscriptionPromise;
|
|
97
|
+
private subscriptionResolved;
|
|
98
|
+
private subscriptionResolve;
|
|
99
|
+
private subscriptionReject;
|
|
100
|
+
private retryTimeoutId;
|
|
101
|
+
private disposed;
|
|
102
|
+
constructor(config: ToolSearchServiceConfig | undefined, scope: ScopeEntry);
|
|
103
|
+
/**
|
|
104
|
+
* Ensures the service is subscribed to tool changes before proceeding.
|
|
105
|
+
* Public methods should call this before accessing tools.
|
|
106
|
+
*/
|
|
107
|
+
private ensureSubscribed;
|
|
108
|
+
/**
|
|
109
|
+
* Sets up subscription to tool changes with exponential backoff retry.
|
|
110
|
+
* Handles the case where scope.tools may not be available yet during plugin initialization.
|
|
111
|
+
*/
|
|
112
|
+
private setupSubscription;
|
|
113
|
+
/**
|
|
114
|
+
* Subscribes to tool changes once scope.tools is available.
|
|
115
|
+
*/
|
|
116
|
+
private subscribeToToolChanges;
|
|
117
|
+
/**
|
|
118
|
+
* Marks the subscription as resolved, allowing pending operations to proceed.
|
|
119
|
+
*/
|
|
120
|
+
private markSubscribed;
|
|
121
|
+
/**
|
|
122
|
+
* Handles tool change events by reindexing all tools from the snapshot
|
|
123
|
+
*/
|
|
124
|
+
private handleToolChange;
|
|
125
|
+
/**
|
|
126
|
+
* Determines if a tool should be indexed in the search database.
|
|
127
|
+
* Filters based on:
|
|
128
|
+
* - Excludes codecall:* meta-tools (they should not be searchable)
|
|
129
|
+
* - Mode-based filtering (codecall_only, codecall_opt_in, metadata_driven)
|
|
130
|
+
* - Per-tool metadata.codecall.enabledInCodeCall
|
|
131
|
+
* - Custom includeTools filter function
|
|
132
|
+
*/
|
|
133
|
+
private shouldIndexTool;
|
|
134
|
+
/**
|
|
135
|
+
* Extract CodeCall-specific metadata from a tool.
|
|
136
|
+
*/
|
|
137
|
+
private getCodeCallMetadata;
|
|
138
|
+
/**
|
|
139
|
+
* Initializes the search service by indexing all tools from the registry.
|
|
140
|
+
* NOTE: This method is now a no-op. Initialization is handled reactively
|
|
141
|
+
* via subscription to tool change events in the constructor.
|
|
142
|
+
* This method exists for interface compatibility.
|
|
143
|
+
*/
|
|
144
|
+
initialize(): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Cleanup subscription and pending retries when service is destroyed
|
|
147
|
+
*/
|
|
148
|
+
dispose(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Extracts searchable text from a tool instance.
|
|
151
|
+
* Uses term weighting to improve relevance:
|
|
152
|
+
* - Description terms are heavily weighted (most important for semantic matching)
|
|
153
|
+
* - Tool name parts are tokenized and weighted
|
|
154
|
+
* - Tags provide additional context
|
|
155
|
+
*/
|
|
156
|
+
private extractSearchableText;
|
|
157
|
+
/**
|
|
158
|
+
* Checks if a word is a common stop word that should not receive extra weighting.
|
|
159
|
+
* Uses module-level STOP_WORDS constant to avoid recreating the Set on each call.
|
|
160
|
+
*/
|
|
161
|
+
private isStopWord;
|
|
162
|
+
/**
|
|
163
|
+
* Extracts app ID from tool's owner lineage
|
|
164
|
+
*/
|
|
165
|
+
private extractAppId;
|
|
166
|
+
/**
|
|
167
|
+
* Searches for tools matching the query
|
|
168
|
+
* Implements the ToolSearch interface
|
|
169
|
+
*/
|
|
170
|
+
search(query: string, options?: SymbolToolSearchOptions): Promise<SymbolToolSearchResult[]>;
|
|
171
|
+
/**
|
|
172
|
+
* Gets all indexed tool names
|
|
173
|
+
*/
|
|
174
|
+
getAllToolNames(): string[];
|
|
175
|
+
/**
|
|
176
|
+
* Gets the total number of indexed tools
|
|
177
|
+
*/
|
|
178
|
+
getTotalCount(): number;
|
|
179
|
+
/**
|
|
180
|
+
* Checks if a tool exists in the index
|
|
181
|
+
*/
|
|
182
|
+
hasTool(toolName: string): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Clears the entire index
|
|
185
|
+
*/
|
|
186
|
+
clear(): void;
|
|
187
|
+
/**
|
|
188
|
+
* Get the current embedding strategy
|
|
189
|
+
*/
|
|
190
|
+
getStrategy(): EmbeddingStrategy;
|
|
191
|
+
/**
|
|
192
|
+
* Check if the service is initialized
|
|
193
|
+
*/
|
|
194
|
+
isInitialized(): boolean;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=tool-search.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-search.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-search.service.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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>;
|
|
29
|
+
//# sourceMappingURL=describe.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.schema.d.ts","sourceRoot":"","sources":["../../src/tools/describe.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB,gXAMK,CAAC;AAE1C,eAAO,MAAM,uBAAuB;;iBAuBlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;iBAoCnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
}
|
|
36
|
+
//# sourceMappingURL=describe.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.tool.d.ts","sourceRoot":"","sources":["../../src/tools/describe.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,WAAW,EAAa,MAAM,eAAe,CAAC;AAO7D,OAAO,EACL,iBAAiB,EAEjB,kBAAkB,EAGnB,MAAM,mBAAmB,CAAC;AAsB3B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IAC7C,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAuDpE;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAuBtB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAkDpB;;OAEG;IACH,OAAO,CAAC,YAAY;IA6BpB;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;CAyBzB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
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;
|
|
116
|
+
//# sourceMappingURL=execute.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.schema.d.ts","sourceRoot":"","sources":["../../src/tools/execute.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,sBAAsB,o7BAoBe,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;iBAcjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AA4CtE;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;iBAG1C,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;iBAG5C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;iBAG3C,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;iBAGxC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;iBAGtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAOlC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAC5F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC1F,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,MAAM,MAAM,qBAAqB,GAC7B,gBAAgB,GAChB,yBAAyB,GACzB,2BAA2B,GAC3B,0BAA0B,GAC1B,uBAAuB,GACvB,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
}
|
|
6
|
+
//# sourceMappingURL=execute.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.tool.d.ts","sourceRoot":"","sources":["../../src/tools/execute.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,qBAAqB,EAIrB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAqD1B,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW;IAC5C,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAwNvE"}
|
package/tools/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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>;
|
|
105
|
+
//# sourceMappingURL=invoke.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke.schema.d.ts","sourceRoot":"","sources":["../../src/tools/invoke.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB,+aASD,CAAC;AAElC,eAAO,MAAM,qBAAqB;;;iBAWhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuB,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
}
|
|
14
|
+
//# sourceMappingURL=invoke.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke.tool.d.ts","sourceRoot":"","sources":["../../src/tools/invoke.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EACL,eAAe,EAEf,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AAazB;;;;;;;GAOG;AAeH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAkCjE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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>;
|
|
31
|
+
//# sourceMappingURL=search.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.schema.d.ts","sourceRoot":"","sources":["../../src/tools/search.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB,kzBAiBO,CAAC;AAE1C,eAAO,MAAM,qBAAqB;;;;;;iBAgBhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;iBAsBjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|