@mastra/mcp 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/_types/hono/dist/types/index.d.ts +2 -1
- package/dist/_types/hono/dist/types/utils/mime.d.ts +11 -11
- package/dist/client/configuration.d.ts +22 -0
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-tools-mcp-client.md +11 -0
- package/dist/index.cjs +29 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1927,8 +1927,31 @@ To fix this you have three different options:
|
|
|
1927
1927
|
* ```
|
|
1928
1928
|
*/
|
|
1929
1929
|
async listTools() {
|
|
1930
|
+
const result = await this.listToolsWithErrors();
|
|
1931
|
+
return result.tools;
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* Retrieves all tools from all configured servers with namespaced names,
|
|
1935
|
+
* along with any per-server errors.
|
|
1936
|
+
*
|
|
1937
|
+
* Like listTools(), but also returns errors for servers that failed to connect
|
|
1938
|
+
* or list tools. This allows callers to report specific failure reasons per server.
|
|
1939
|
+
*
|
|
1940
|
+
* @returns Object with `tools` (successful tools) and `errors` (failed servers with error messages).
|
|
1941
|
+
* Transient connection failures are retried once after reconnecting the affected server.
|
|
1942
|
+
*
|
|
1943
|
+
* @example
|
|
1944
|
+
* ```typescript
|
|
1945
|
+
* const { tools, errors } = await mcp.listToolsWithErrors();
|
|
1946
|
+
* for (const [name, err] of Object.entries(errors)) {
|
|
1947
|
+
* console.error(`Server ${name} failed: ${err}`);
|
|
1948
|
+
* }
|
|
1949
|
+
* ```
|
|
1950
|
+
*/
|
|
1951
|
+
async listToolsWithErrors() {
|
|
1930
1952
|
this.addToInstanceCache();
|
|
1931
1953
|
const connectedTools = {};
|
|
1954
|
+
const errors = {};
|
|
1932
1955
|
for (const serverName of Object.keys(this.serverConfigs)) {
|
|
1933
1956
|
try {
|
|
1934
1957
|
const tools = await this.getToolsForServer(serverName);
|
|
@@ -1949,9 +1972,10 @@ To fix this you have three different options:
|
|
|
1949
1972
|
);
|
|
1950
1973
|
this.logger.trackException(mastraError);
|
|
1951
1974
|
this.logger.error("Failed to list tools from server:", { error: mastraError.toString() });
|
|
1975
|
+
errors[serverName] = error instanceof Error ? error.message : String(error);
|
|
1952
1976
|
}
|
|
1953
1977
|
}
|
|
1954
|
-
return connectedTools;
|
|
1978
|
+
return { tools: connectedTools, errors };
|
|
1955
1979
|
}
|
|
1956
1980
|
/**
|
|
1957
1981
|
* Returns toolsets organized by server name for dynamic tool injection.
|
|
@@ -2350,7 +2374,7 @@ function createSimpleTokenProvider(accessToken, options) {
|
|
|
2350
2374
|
});
|
|
2351
2375
|
}
|
|
2352
2376
|
|
|
2353
|
-
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.
|
|
2377
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.25/56d2d0ad7d061ad7c69e37ba3e5d5b4b8565e67d753d2ff1fcac3c36501e42df/node_modules/hono/dist/utils/stream.js
|
|
2354
2378
|
var StreamingApi = class {
|
|
2355
2379
|
writer;
|
|
2356
2380
|
encoder;
|
|
@@ -2429,7 +2453,7 @@ var StreamingApi = class {
|
|
|
2429
2453
|
}
|
|
2430
2454
|
};
|
|
2431
2455
|
|
|
2432
|
-
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.
|
|
2456
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.25/56d2d0ad7d061ad7c69e37ba3e5d5b4b8565e67d753d2ff1fcac3c36501e42df/node_modules/hono/dist/helper/streaming/utils.js
|
|
2433
2457
|
var isOldBunVersion = () => {
|
|
2434
2458
|
const version = typeof Bun !== "undefined" ? Bun.version : void 0;
|
|
2435
2459
|
if (version === void 0) {
|
|
@@ -2440,7 +2464,7 @@ var isOldBunVersion = () => {
|
|
|
2440
2464
|
return result;
|
|
2441
2465
|
};
|
|
2442
2466
|
|
|
2443
|
-
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.
|
|
2467
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.25/56d2d0ad7d061ad7c69e37ba3e5d5b4b8565e67d753d2ff1fcac3c36501e42df/node_modules/hono/dist/utils/html.js
|
|
2444
2468
|
var HtmlEscapedCallbackPhase = {
|
|
2445
2469
|
Stringify: 1};
|
|
2446
2470
|
var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
|
|
@@ -2471,7 +2495,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
2471
2495
|
}
|
|
2472
2496
|
};
|
|
2473
2497
|
|
|
2474
|
-
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.
|
|
2498
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/hono/4.12.25/56d2d0ad7d061ad7c69e37ba3e5d5b4b8565e67d753d2ff1fcac3c36501e42df/node_modules/hono/dist/helper/streaming/sse.js
|
|
2475
2499
|
var SSEStreamingApi = class extends StreamingApi {
|
|
2476
2500
|
constructor(writable, readable) {
|
|
2477
2501
|
super(writable, readable);
|