Merge pull request #6 from modelcontextprotocol/justin/remove-js-artifacts
Remove node_modules and JS build
This commit is contained in:
commit
b218bd6478
468 changed files with 8 additions and 538151 deletions
|
|
@ -1,7 +1,11 @@
|
|||
build/
|
||||
|
||||
# Node-generated files
|
||||
node_modules/
|
||||
|
||||
# Python-generated files
|
||||
__pycache__/
|
||||
*.py[oc]
|
||||
build/
|
||||
dist/
|
||||
wheels/
|
||||
*.egg-info
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { z } from "zod";
|
||||
const NWS_API_BASE = "https://api.weather.gov";
|
||||
const USER_AGENT = "weather-app/1.0";
|
||||
// Define Zod schemas for validation
|
||||
const AlertsArgumentsSchema = z.object({
|
||||
state: z.string().length(2),
|
||||
});
|
||||
const ForecastArgumentsSchema = z.object({
|
||||
latitude: z.number().min(-90).max(90),
|
||||
longitude: z.number().min(-180).max(180),
|
||||
});
|
||||
// Create server instance
|
||||
const server = new Server({
|
||||
name: "weather",
|
||||
version: "1.0.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
tools: {},
|
||||
},
|
||||
});
|
||||
// List available tools
|
||||
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
||||
return {
|
||||
tools: [
|
||||
{
|
||||
name: "get-alerts",
|
||||
description: "Get weather alerts for a state",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
state: {
|
||||
type: "string",
|
||||
description: "Two-letter state code (e.g. CA, NY)",
|
||||
},
|
||||
},
|
||||
required: ["state"],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "get-forecast",
|
||||
description: "Get weather forecast for a location",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
latitude: {
|
||||
type: "number",
|
||||
description: "Latitude of the location",
|
||||
},
|
||||
longitude: {
|
||||
type: "number",
|
||||
description: "Longitude of the location",
|
||||
},
|
||||
},
|
||||
required: ["latitude", "longitude"],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
// Helper function for making NWS API requests
|
||||
async function makeNWSRequest(url) {
|
||||
const headers = {
|
||||
"User-Agent": USER_AGENT,
|
||||
Accept: "application/geo+json",
|
||||
};
|
||||
try {
|
||||
const response = await fetch(url, { headers });
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
return (await response.json());
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Error making NWS request:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// Format alert data
|
||||
function formatAlert(feature) {
|
||||
const props = feature.properties;
|
||||
return [
|
||||
`Event: ${props.event || "Unknown"}`,
|
||||
`Area: ${props.areaDesc || "Unknown"}`,
|
||||
`Severity: ${props.severity || "Unknown"}`,
|
||||
`Status: ${props.status || "Unknown"}`,
|
||||
`Headline: ${props.headline || "No headline"}`,
|
||||
"---",
|
||||
].join("\n");
|
||||
}
|
||||
// Handle tool execution
|
||||
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
||||
const { name, arguments: args } = request.params;
|
||||
try {
|
||||
if (name === "get-alerts") {
|
||||
const { state } = AlertsArgumentsSchema.parse(args);
|
||||
const stateCode = state.toUpperCase();
|
||||
const alertsUrl = `${NWS_API_BASE}/alerts?area=${stateCode}`;
|
||||
const alertsData = await makeNWSRequest(alertsUrl);
|
||||
if (!alertsData) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "Failed to retrieve alerts data",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
const features = alertsData.features || [];
|
||||
if (features.length === 0) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: `No active alerts for ${stateCode}`,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
const formattedAlerts = features.map(formatAlert);
|
||||
const alertsText = `Active alerts for ${stateCode}:\n\n${formattedAlerts.join("\n")}`;
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: alertsText,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
else if (name === "get-forecast") {
|
||||
const { latitude, longitude } = ForecastArgumentsSchema.parse(args);
|
||||
// Get grid point data
|
||||
const pointsUrl = `${NWS_API_BASE}/points/${latitude.toFixed(4)},${longitude.toFixed(4)}`;
|
||||
const pointsData = await makeNWSRequest(pointsUrl);
|
||||
if (!pointsData) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: `Failed to retrieve grid point data for coordinates: ${latitude}, ${longitude}. This location may not be supported by the NWS API (only US locations are supported).`,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
const forecastUrl = pointsData.properties?.forecast;
|
||||
if (!forecastUrl) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "Failed to get forecast URL from grid point data",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
// Get forecast data
|
||||
const forecastData = await makeNWSRequest(forecastUrl);
|
||||
if (!forecastData) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "Failed to retrieve forecast data",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
const periods = forecastData.properties?.periods || [];
|
||||
if (periods.length === 0) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "No forecast periods available",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
// Format forecast periods
|
||||
const formattedForecast = periods.map((period) => [
|
||||
`${period.name || "Unknown"}:`,
|
||||
`Temperature: ${period.temperature || "Unknown"}°${period.temperatureUnit || "F"}`,
|
||||
`Wind: ${period.windSpeed || "Unknown"} ${period.windDirection || ""}`,
|
||||
`${period.shortForecast || "No forecast available"}`,
|
||||
"---",
|
||||
].join("\n"));
|
||||
const forecastText = `Forecast for ${latitude}, ${longitude}:\n\n${formattedForecast.join("\n")}`;
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: forecastText,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown tool: ${name}`);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof z.ZodError) {
|
||||
throw new Error(`Invalid arguments: ${error.errors
|
||||
.map((e) => `${e.path.join(".")}: ${e.message}`)
|
||||
.join(", ")}`);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
// Start the server
|
||||
async function main() {
|
||||
const transport = new StdioServerTransport();
|
||||
await server.connect(transport);
|
||||
console.error("Weather MCP Server running on stdio");
|
||||
}
|
||||
main().catch((error) => {
|
||||
console.error("Fatal error in main():", error);
|
||||
process.exit(1);
|
||||
});
|
||||
1
weather-server-typescript/node_modules/.bin/tsc
generated
vendored
1
weather-server-typescript/node_modules/.bin/tsc
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
../typescript/bin/tsc
|
||||
1
weather-server-typescript/node_modules/.bin/tsserver
generated
vendored
1
weather-server-typescript/node_modules/.bin/tsserver
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
../typescript/bin/tsserver
|
||||
157
weather-server-typescript/node_modules/.package-lock.json
generated
vendored
157
weather-server-typescript/node_modules/.package-lock.json
generated
vendored
|
|
@ -1,157 +0,0 @@
|
|||
{
|
||||
"name": "mcp-quickstart-ts",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@modelcontextprotocol/sdk": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/@modelcontextprotocol/sdk/-/sdk-1.0.3.tgz",
|
||||
"integrity": "sha512-2as3cX/VJ0YBHGmdv3GFyTpoM8q2gqE98zh3Vf1NwnsSY0h3mvoO07MUzfygCKkWsFjcZm4otIiqD6Xh7kiSBQ==",
|
||||
"dependencies": {
|
||||
"content-type": "^1.0.5",
|
||||
"raw-body": "^3.0.0",
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.10.0",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/@types/node/-/node-22.10.0.tgz",
|
||||
"integrity": "sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~6.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/bytes/3.1.2/bytes-3.1.2.tgz",
|
||||
"integrity": "sha1-iwvuuYYFrfGxKPpDhkA8AJ4CIaU=",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/content-type/1.0.5/content-type-1.0.5.tgz",
|
||||
"integrity": "sha1-i3cxYmVtHRCGeEyPI6VM5tc9eRg=",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/depd/2.0.0/depd-2.0.0.tgz",
|
||||
"integrity": "sha1-tpYWPMdXVg0JzyLMj60Vcbeedt8=",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/http-errors/2.0.0/http-errors-2.0.0.tgz",
|
||||
"integrity": "sha1-t3dKFIbvc892Z6ya4IWMASxXudM=",
|
||||
"dependencies": {
|
||||
"depd": "2.0.0",
|
||||
"inherits": "2.0.4",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "2.0.1",
|
||||
"toidentifier": "1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/iconv-lite/0.6.3/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha1-pS+AvzjaGVLrXGgXkHGYcaGnJQE=",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/inherits/2.0.4/inherits-2.0.4.tgz",
|
||||
"integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w="
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/raw-body/-/raw-body-3.0.0.tgz",
|
||||
"integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==",
|
||||
"dependencies": {
|
||||
"bytes": "3.1.2",
|
||||
"http-errors": "2.0.0",
|
||||
"iconv-lite": "0.6.3",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/safer-buffer/2.1.2/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo="
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/setprototypeof/1.2.0/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha1-ZsmiSnP5/CjL5msJ/tPTPcrxtCQ="
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/statuses/2.0.1/statuses-2.0.1.tgz",
|
||||
"integrity": "sha1-VcsADM8dSHKL0jxoWgY5mM8aG2M=",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/toidentifier/1.0.1/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha1-O+NDIaiKgg7RvYDfqjPkefu43TU=",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.7.2",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/typescript/-/typescript-5.7.2.tgz",
|
||||
"integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/undici-types/-/undici-types-6.20.0.tgz",
|
||||
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/unpipe/1.0.0/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "3.23.8",
|
||||
"resolved": "https://artifactory.infra.ant.dev:443/artifactory/api/npm/npm-all/zod/3.23.8/zod-3.23.8.tgz",
|
||||
"integrity": "sha1-43uVe11SB5dp+4CXCZtZLw70Bn0=",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/LICENSE
generated
vendored
21
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/LICENSE
generated
vendored
|
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Anthropic, PBC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
117
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/README.md
generated
vendored
117
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/README.md
generated
vendored
|
|
@ -1,117 +0,0 @@
|
|||
# MCP TypeScript SDK 
|
||||
|
||||
TypeScript implementation of the [Model Context Protocol](https://modelcontextprotocol.io) (MCP), providing both client and server capabilities for integrating with LLM surfaces.
|
||||
|
||||
## Overview
|
||||
|
||||
The Model Context Protocol allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction. This TypeScript SDK implements the full MCP specification, making it easy to:
|
||||
|
||||
- Build MCP clients that can connect to any MCP server
|
||||
- Create MCP servers that expose resources, prompts and tools
|
||||
- Use standard transports like stdio and SSE
|
||||
- Handle all MCP protocol messages and lifecycle events
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @modelcontextprotocol/sdk
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Creating a Client
|
||||
|
||||
```typescript
|
||||
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
||||
|
||||
const transport = new StdioClientTransport({
|
||||
command: "path/to/server",
|
||||
});
|
||||
|
||||
const client = new Client({
|
||||
name: "example-client",
|
||||
version: "1.0.0",
|
||||
}, {
|
||||
capabilities: {}
|
||||
});
|
||||
|
||||
await client.connect(transport);
|
||||
|
||||
// List available resources
|
||||
const resources = await client.request(
|
||||
{ method: "resources/list" },
|
||||
ListResourcesResultSchema
|
||||
);
|
||||
|
||||
// Read a specific resource
|
||||
const resourceContent = await client.request(
|
||||
{
|
||||
method: "resources/read",
|
||||
params: {
|
||||
uri: "file:///example.txt"
|
||||
}
|
||||
},
|
||||
ReadResourceResultSchema
|
||||
);
|
||||
```
|
||||
|
||||
### Creating a Server
|
||||
|
||||
```typescript
|
||||
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
||||
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
||||
|
||||
const server = new Server({
|
||||
name: "example-server",
|
||||
version: "1.0.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
resources: {}
|
||||
}
|
||||
});
|
||||
|
||||
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
||||
return {
|
||||
resources: [
|
||||
{
|
||||
uri: "file:///example.txt",
|
||||
name: "Example Resource",
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
||||
if (request.params.uri === "file:///example.txt") {
|
||||
return {
|
||||
contents: [
|
||||
{
|
||||
uri: "file:///example.txt",
|
||||
mimeType: "text/plain",
|
||||
text: "This is the content of the example resource.",
|
||||
},
|
||||
],
|
||||
};
|
||||
} else {
|
||||
throw new Error("Resource not found");
|
||||
}
|
||||
});
|
||||
|
||||
const transport = new StdioServerTransport();
|
||||
await server.connect(transport);
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Model Context Protocol documentation](https://modelcontextprotocol.io)
|
||||
- [MCP Specification](https://spec.modelcontextprotocol.io)
|
||||
- [Example Servers](https://github.com/modelcontextprotocol/servers)
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues and pull requests are welcome on GitHub at https://github.com/modelcontextprotocol/typescript-sdk.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License—see the [LICENSE](LICENSE) file for details.
|
||||
2
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/cli.d.ts
generated
vendored
2
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/cli.d.ts
generated
vendored
|
|
@ -1,2 +0,0 @@
|
|||
export {};
|
||||
//# sourceMappingURL=cli.d.ts.map
|
||||
1
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/cli.d.ts.map
generated
vendored
1
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/cli.d.ts.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
||||
129
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/cli.js
generated
vendored
129
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/cli.js
generated
vendored
|
|
@ -1,129 +0,0 @@
|
|||
import EventSource from "eventsource";
|
||||
import WebSocket from "ws";
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
global.EventSource = EventSource;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
global.WebSocket = WebSocket;
|
||||
import express from "express";
|
||||
import { Client } from "./client/index.js";
|
||||
import { SSEClientTransport } from "./client/sse.js";
|
||||
import { StdioClientTransport } from "./client/stdio.js";
|
||||
import { WebSocketClientTransport } from "./client/websocket.js";
|
||||
import { Server } from "./server/index.js";
|
||||
import { SSEServerTransport } from "./server/sse.js";
|
||||
import { StdioServerTransport } from "./server/stdio.js";
|
||||
import { ListResourcesResultSchema } from "./types.js";
|
||||
async function runClient(url_or_command, args) {
|
||||
const client = new Client({
|
||||
name: "mcp-typescript test client",
|
||||
version: "0.1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
sampling: {},
|
||||
},
|
||||
});
|
||||
let clientTransport;
|
||||
let url = undefined;
|
||||
try {
|
||||
url = new URL(url_or_command);
|
||||
}
|
||||
catch (_a) {
|
||||
// Ignore
|
||||
}
|
||||
if ((url === null || url === void 0 ? void 0 : url.protocol) === "http:" || (url === null || url === void 0 ? void 0 : url.protocol) === "https:") {
|
||||
clientTransport = new SSEClientTransport(new URL(url_or_command));
|
||||
}
|
||||
else if ((url === null || url === void 0 ? void 0 : url.protocol) === "ws:" || (url === null || url === void 0 ? void 0 : url.protocol) === "wss:") {
|
||||
clientTransport = new WebSocketClientTransport(new URL(url_or_command));
|
||||
}
|
||||
else {
|
||||
clientTransport = new StdioClientTransport({
|
||||
command: url_or_command,
|
||||
args,
|
||||
});
|
||||
}
|
||||
console.log("Connected to server.");
|
||||
await client.connect(clientTransport);
|
||||
console.log("Initialized.");
|
||||
await client.request({ method: "resources/list" }, ListResourcesResultSchema);
|
||||
await client.close();
|
||||
console.log("Closed.");
|
||||
}
|
||||
async function runServer(port) {
|
||||
if (port !== null) {
|
||||
const app = express();
|
||||
let servers = [];
|
||||
app.get("/sse", async (req, res) => {
|
||||
console.log("Got new SSE connection");
|
||||
const transport = new SSEServerTransport("/message", res);
|
||||
const server = new Server({
|
||||
name: "mcp-typescript test server",
|
||||
version: "0.1.0",
|
||||
}, {
|
||||
capabilities: {},
|
||||
});
|
||||
servers.push(server);
|
||||
server.onclose = () => {
|
||||
console.log("SSE connection closed");
|
||||
servers = servers.filter((s) => s !== server);
|
||||
};
|
||||
await server.connect(transport);
|
||||
});
|
||||
app.post("/message", async (req, res) => {
|
||||
console.log("Received message");
|
||||
const sessionId = req.query.sessionId;
|
||||
const transport = servers
|
||||
.map((s) => s.transport)
|
||||
.find((t) => t.sessionId === sessionId);
|
||||
if (!transport) {
|
||||
res.status(404).send("Session not found");
|
||||
return;
|
||||
}
|
||||
await transport.handlePostMessage(req, res);
|
||||
});
|
||||
app.listen(port, () => {
|
||||
console.log(`Server running on http://localhost:${port}/sse`);
|
||||
});
|
||||
}
|
||||
else {
|
||||
const server = new Server({
|
||||
name: "mcp-typescript test server",
|
||||
version: "0.1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
prompts: {},
|
||||
resources: {},
|
||||
tools: {},
|
||||
logging: {},
|
||||
},
|
||||
});
|
||||
const transport = new StdioServerTransport();
|
||||
await server.connect(transport);
|
||||
console.log("Server running on stdio");
|
||||
}
|
||||
}
|
||||
const args = process.argv.slice(2);
|
||||
const command = args[0];
|
||||
switch (command) {
|
||||
case "client":
|
||||
if (args.length < 2) {
|
||||
console.error("Usage: client <server_url_or_command> [args...]");
|
||||
process.exit(1);
|
||||
}
|
||||
runClient(args[1], args.slice(2)).catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
break;
|
||||
case "server": {
|
||||
const port = args[1] ? parseInt(args[1]) : null;
|
||||
runServer(port).catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
console.error("Unrecognized command:", command);
|
||||
}
|
||||
//# sourceMappingURL=cli.js.map
|
||||
1
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/cli.js.map
generated
vendored
1
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/cli.js.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"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"}
|
||||
773
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/client/index.d.ts
generated
vendored
773
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/client/index.d.ts
generated
vendored
|
|
@ -1,773 +0,0 @@
|
|||
import { Protocol, ProtocolOptions, RequestOptions } from "../shared/protocol.js";
|
||||
import { Transport } from "../shared/transport.js";
|
||||
import { CallToolRequest, CallToolResultSchema, ClientCapabilities, ClientNotification, ClientRequest, ClientResult, CompatibilityCallToolResultSchema, CompleteRequest, GetPromptRequest, Implementation, ListPromptsRequest, ListResourcesRequest, ListResourceTemplatesRequest, ListToolsRequest, LoggingLevel, Notification, ReadResourceRequest, Request, Result, ServerCapabilities, SubscribeRequest, UnsubscribeRequest } from "../types.js";
|
||||
export type ClientOptions = ProtocolOptions & {
|
||||
/**
|
||||
* Capabilities to advertise as being supported by this client.
|
||||
*/
|
||||
capabilities: ClientCapabilities;
|
||||
};
|
||||
/**
|
||||
* An MCP client on top of a pluggable transport.
|
||||
*
|
||||
* The client will automatically begin the initialization flow with the server when connect() is called.
|
||||
*
|
||||
* To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters:
|
||||
*
|
||||
* ```typescript
|
||||
* // Custom schemas
|
||||
* const CustomRequestSchema = RequestSchema.extend({...})
|
||||
* const CustomNotificationSchema = NotificationSchema.extend({...})
|
||||
* const CustomResultSchema = ResultSchema.extend({...})
|
||||
*
|
||||
* // Type aliases
|
||||
* type CustomRequest = z.infer<typeof CustomRequestSchema>
|
||||
* type CustomNotification = z.infer<typeof CustomNotificationSchema>
|
||||
* type CustomResult = z.infer<typeof CustomResultSchema>
|
||||
*
|
||||
* // Create typed client
|
||||
* const client = new Client<CustomRequest, CustomNotification, CustomResult>({
|
||||
* name: "CustomClient",
|
||||
* version: "1.0.0"
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export declare class Client<RequestT extends Request = Request, NotificationT extends Notification = Notification, ResultT extends Result = Result> extends Protocol<ClientRequest | RequestT, ClientNotification | NotificationT, ClientResult | ResultT> {
|
||||
private _clientInfo;
|
||||
private _serverCapabilities?;
|
||||
private _serverVersion?;
|
||||
private _capabilities;
|
||||
/**
|
||||
* Initializes this client with the given name and version information.
|
||||
*/
|
||||
constructor(_clientInfo: Implementation, options: ClientOptions);
|
||||
protected assertCapability(capability: keyof ServerCapabilities, method: string): void;
|
||||
connect(transport: Transport): Promise<void>;
|
||||
/**
|
||||
* After initialization has completed, this will be populated with the server's reported capabilities.
|
||||
*/
|
||||
getServerCapabilities(): ServerCapabilities | undefined;
|
||||
/**
|
||||
* After initialization has completed, this will be populated with information about the server's name and version.
|
||||
*/
|
||||
getServerVersion(): Implementation | undefined;
|
||||
protected assertCapabilityForMethod(method: RequestT["method"]): void;
|
||||
protected assertNotificationCapability(method: NotificationT["method"]): void;
|
||||
protected assertRequestHandlerCapability(method: string): void;
|
||||
ping(options?: RequestOptions): Promise<{
|
||||
_meta?: import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
||||
}>;
|
||||
complete(params: CompleteRequest["params"], options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
completion: import("zod").ZodObject<{
|
||||
values: import("zod").ZodArray<import("zod").ZodString, "many">;
|
||||
total: import("zod").ZodOptional<import("zod").ZodNumber>;
|
||||
hasMore: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
values: import("zod").ZodArray<import("zod").ZodString, "many">;
|
||||
total: import("zod").ZodOptional<import("zod").ZodNumber>;
|
||||
hasMore: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
values: import("zod").ZodArray<import("zod").ZodString, "many">;
|
||||
total: import("zod").ZodOptional<import("zod").ZodNumber>;
|
||||
hasMore: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>;
|
||||
setLoggingLevel(level: LoggingLevel, options?: RequestOptions): Promise<{
|
||||
_meta?: import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
||||
}>;
|
||||
getPrompt(params: GetPromptRequest["params"], options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
messages: import("zod").ZodArray<import("zod").ZodObject<{
|
||||
role: import("zod").ZodEnum<["user", "assistant"]>;
|
||||
content: import("zod").ZodUnion<[import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
role: import("zod").ZodEnum<["user", "assistant"]>;
|
||||
content: import("zod").ZodUnion<[import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
role: import("zod").ZodEnum<["user", "assistant"]>;
|
||||
content: import("zod").ZodUnion<[import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>;
|
||||
listPrompts(params?: ListPromptsRequest["params"], options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
nextCursor: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}>, {
|
||||
prompts: import("zod").ZodArray<import("zod").ZodObject<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
arguments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
arguments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
arguments: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
required: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>;
|
||||
listResources(params?: ListResourcesRequest["params"], options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
nextCursor: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}>, {
|
||||
resources: import("zod").ZodArray<import("zod").ZodObject<{
|
||||
uri: import("zod").ZodString;
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
uri: import("zod").ZodString;
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
uri: import("zod").ZodString;
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>;
|
||||
listResourceTemplates(params?: ListResourceTemplatesRequest["params"], options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
nextCursor: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}>, {
|
||||
resourceTemplates: import("zod").ZodArray<import("zod").ZodObject<{
|
||||
uriTemplate: import("zod").ZodString;
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
uriTemplate: import("zod").ZodString;
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
uriTemplate: import("zod").ZodString;
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>;
|
||||
readResource(params: ReadResourceRequest["params"], options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
contents: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>, "many">;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>;
|
||||
subscribeResource(params: SubscribeRequest["params"], options?: RequestOptions): Promise<{
|
||||
_meta?: import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
||||
}>;
|
||||
unsubscribeResource(params: UnsubscribeRequest["params"], options?: RequestOptions): Promise<{
|
||||
_meta?: import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
||||
}>;
|
||||
callTool(params: CallToolRequest["params"], resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
content: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"text">;
|
||||
text: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"image">;
|
||||
data: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodString;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"resource">;
|
||||
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
text: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
||||
uri: import("zod").ZodString;
|
||||
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}, {
|
||||
blob: import("zod").ZodString;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>]>, "many">;
|
||||
isError: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
|
||||
}>, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
toolResult: import("zod").ZodUnknown;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>;
|
||||
listTools(params?: ListToolsRequest["params"], options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
|
||||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, {
|
||||
nextCursor: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
}>, {
|
||||
tools: import("zod").ZodArray<import("zod").ZodObject<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
inputSchema: import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
inputSchema: import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
name: import("zod").ZodString;
|
||||
description: import("zod").ZodOptional<import("zod").ZodString>;
|
||||
inputSchema: import("zod").ZodObject<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
||||
type: import("zod").ZodLiteral<"object">;
|
||||
properties: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>;
|
||||
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
||||
}>, import("zod").ZodTypeAny, "passthrough">>;
|
||||
sendRootsListChanged(): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"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"}
|
||||
206
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/client/index.js
generated
vendored
206
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/client/index.js
generated
vendored
|
|
@ -1,206 +0,0 @@
|
|||
import { Protocol, } from "../shared/protocol.js";
|
||||
import { CallToolResultSchema, CompleteResultSchema, EmptyResultSchema, GetPromptResultSchema, InitializeResultSchema, LATEST_PROTOCOL_VERSION, ListPromptsResultSchema, ListResourcesResultSchema, ListResourceTemplatesResultSchema, ListToolsResultSchema, ReadResourceResultSchema, SUPPORTED_PROTOCOL_VERSIONS, } from "../types.js";
|
||||
/**
|
||||
* An MCP client on top of a pluggable transport.
|
||||
*
|
||||
* The client will automatically begin the initialization flow with the server when connect() is called.
|
||||
*
|
||||
* To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters:
|
||||
*
|
||||
* ```typescript
|
||||
* // Custom schemas
|
||||
* const CustomRequestSchema = RequestSchema.extend({...})
|
||||
* const CustomNotificationSchema = NotificationSchema.extend({...})
|
||||
* const CustomResultSchema = ResultSchema.extend({...})
|
||||
*
|
||||
* // Type aliases
|
||||
* type CustomRequest = z.infer<typeof CustomRequestSchema>
|
||||
* type CustomNotification = z.infer<typeof CustomNotificationSchema>
|
||||
* type CustomResult = z.infer<typeof CustomResultSchema>
|
||||
*
|
||||
* // Create typed client
|
||||
* const client = new Client<CustomRequest, CustomNotification, CustomResult>({
|
||||
* name: "CustomClient",
|
||||
* version: "1.0.0"
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export class Client extends Protocol {
|
||||
/**
|
||||
* Initializes this client with the given name and version information.
|
||||
*/
|
||||
constructor(_clientInfo, options) {
|
||||
super(options);
|
||||
this._clientInfo = _clientInfo;
|
||||
this._capabilities = options.capabilities;
|
||||
}
|
||||
assertCapability(capability, method) {
|
||||
var _a;
|
||||
if (!((_a = this._serverCapabilities) === null || _a === void 0 ? void 0 : _a[capability])) {
|
||||
throw new Error(`Server does not support ${capability} (required for ${method})`);
|
||||
}
|
||||
}
|
||||
async connect(transport) {
|
||||
await super.connect(transport);
|
||||
try {
|
||||
const result = await this.request({
|
||||
method: "initialize",
|
||||
params: {
|
||||
protocolVersion: LATEST_PROTOCOL_VERSION,
|
||||
capabilities: this._capabilities,
|
||||
clientInfo: this._clientInfo,
|
||||
},
|
||||
}, InitializeResultSchema);
|
||||
if (result === undefined) {
|
||||
throw new Error(`Server sent invalid initialize result: ${result}`);
|
||||
}
|
||||
if (!SUPPORTED_PROTOCOL_VERSIONS.includes(result.protocolVersion)) {
|
||||
throw new Error(`Server's protocol version is not supported: ${result.protocolVersion}`);
|
||||
}
|
||||
this._serverCapabilities = result.capabilities;
|
||||
this._serverVersion = result.serverInfo;
|
||||
await this.notification({
|
||||
method: "notifications/initialized",
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
// Disconnect if initialization fails.
|
||||
void this.close();
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* After initialization has completed, this will be populated with the server's reported capabilities.
|
||||
*/
|
||||
getServerCapabilities() {
|
||||
return this._serverCapabilities;
|
||||
}
|
||||
/**
|
||||
* After initialization has completed, this will be populated with information about the server's name and version.
|
||||
*/
|
||||
getServerVersion() {
|
||||
return this._serverVersion;
|
||||
}
|
||||
assertCapabilityForMethod(method) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
switch (method) {
|
||||
case "logging/setLevel":
|
||||
if (!((_a = this._serverCapabilities) === null || _a === void 0 ? void 0 : _a.logging)) {
|
||||
throw new Error(`Server does not support logging (required for ${method})`);
|
||||
}
|
||||
break;
|
||||
case "prompts/get":
|
||||
case "prompts/list":
|
||||
if (!((_b = this._serverCapabilities) === null || _b === void 0 ? void 0 : _b.prompts)) {
|
||||
throw new Error(`Server does not support prompts (required for ${method})`);
|
||||
}
|
||||
break;
|
||||
case "resources/list":
|
||||
case "resources/templates/list":
|
||||
case "resources/read":
|
||||
case "resources/subscribe":
|
||||
case "resources/unsubscribe":
|
||||
if (!((_c = this._serverCapabilities) === null || _c === void 0 ? void 0 : _c.resources)) {
|
||||
throw new Error(`Server does not support resources (required for ${method})`);
|
||||
}
|
||||
if (method === "resources/subscribe" &&
|
||||
!this._serverCapabilities.resources.subscribe) {
|
||||
throw new Error(`Server does not support resource subscriptions (required for ${method})`);
|
||||
}
|
||||
break;
|
||||
case "tools/call":
|
||||
case "tools/list":
|
||||
if (!((_d = this._serverCapabilities) === null || _d === void 0 ? void 0 : _d.tools)) {
|
||||
throw new Error(`Server does not support tools (required for ${method})`);
|
||||
}
|
||||
break;
|
||||
case "completion/complete":
|
||||
if (!((_e = this._serverCapabilities) === null || _e === void 0 ? void 0 : _e.prompts)) {
|
||||
throw new Error(`Server does not support prompts (required for ${method})`);
|
||||
}
|
||||
break;
|
||||
case "initialize":
|
||||
// No specific capability required for initialize
|
||||
break;
|
||||
case "ping":
|
||||
// No specific capability required for ping
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertNotificationCapability(method) {
|
||||
var _a;
|
||||
switch (method) {
|
||||
case "notifications/roots/list_changed":
|
||||
if (!((_a = this._capabilities.roots) === null || _a === void 0 ? void 0 : _a.listChanged)) {
|
||||
throw new Error(`Client does not support roots list changed notifications (required for ${method})`);
|
||||
}
|
||||
break;
|
||||
case "notifications/initialized":
|
||||
// No specific capability required for initialized
|
||||
break;
|
||||
case "notifications/cancelled":
|
||||
// Cancellation notifications are always allowed
|
||||
break;
|
||||
case "notifications/progress":
|
||||
// Progress notifications are always allowed
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertRequestHandlerCapability(method) {
|
||||
switch (method) {
|
||||
case "sampling/createMessage":
|
||||
if (!this._capabilities.sampling) {
|
||||
throw new Error(`Client does not support sampling capability (required for ${method})`);
|
||||
}
|
||||
break;
|
||||
case "roots/list":
|
||||
if (!this._capabilities.roots) {
|
||||
throw new Error(`Client does not support roots capability (required for ${method})`);
|
||||
}
|
||||
break;
|
||||
case "ping":
|
||||
// No specific capability required for ping
|
||||
break;
|
||||
}
|
||||
}
|
||||
async ping(options) {
|
||||
return this.request({ method: "ping" }, EmptyResultSchema, options);
|
||||
}
|
||||
async complete(params, options) {
|
||||
return this.request({ method: "completion/complete", params }, CompleteResultSchema, options);
|
||||
}
|
||||
async setLoggingLevel(level, options) {
|
||||
return this.request({ method: "logging/setLevel", params: { level } }, EmptyResultSchema, options);
|
||||
}
|
||||
async getPrompt(params, options) {
|
||||
return this.request({ method: "prompts/get", params }, GetPromptResultSchema, options);
|
||||
}
|
||||
async listPrompts(params, options) {
|
||||
return this.request({ method: "prompts/list", params }, ListPromptsResultSchema, options);
|
||||
}
|
||||
async listResources(params, options) {
|
||||
return this.request({ method: "resources/list", params }, ListResourcesResultSchema, options);
|
||||
}
|
||||
async listResourceTemplates(params, options) {
|
||||
return this.request({ method: "resources/templates/list", params }, ListResourceTemplatesResultSchema, options);
|
||||
}
|
||||
async readResource(params, options) {
|
||||
return this.request({ method: "resources/read", params }, ReadResourceResultSchema, options);
|
||||
}
|
||||
async subscribeResource(params, options) {
|
||||
return this.request({ method: "resources/subscribe", params }, EmptyResultSchema, options);
|
||||
}
|
||||
async unsubscribeResource(params, options) {
|
||||
return this.request({ method: "resources/unsubscribe", params }, EmptyResultSchema, options);
|
||||
}
|
||||
async callTool(params, resultSchema = CallToolResultSchema, options) {
|
||||
return this.request({ method: "tools/call", params }, resultSchema, options);
|
||||
}
|
||||
async listTools(params, options) {
|
||||
return this.request({ method: "tools/list", params }, ListToolsResultSchema, options);
|
||||
}
|
||||
async sendRootsListChanged() {
|
||||
return this.notification({ method: "notifications/roots/list_changed" });
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,2 +0,0 @@
|
|||
export {};
|
||||
//# sourceMappingURL=index.test.d.ts.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/client/index.test.ts"],"names":[],"mappings":""}
|
||||
393
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.js
generated
vendored
393
weather-server-typescript/node_modules/@modelcontextprotocol/sdk/dist/client/index.test.js
generated
vendored
|
|
@ -1,393 +0,0 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable no-constant-binary-expression */
|
||||
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
||||
import { Client } from "./index.js";
|
||||
import { z } from "zod";
|
||||
import { RequestSchema, NotificationSchema, ResultSchema, LATEST_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, InitializeRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, CreateMessageRequestSchema, ListRootsRequestSchema, ErrorCode, } from "../types.js";
|
||||
import { Server } from "../server/index.js";
|
||||
import { InMemoryTransport } from "../inMemory.js";
|
||||
test("should initialize with matching protocol version", async () => {
|
||||
const clientTransport = {
|
||||
start: jest.fn().mockResolvedValue(undefined),
|
||||
close: jest.fn().mockResolvedValue(undefined),
|
||||
send: jest.fn().mockImplementation((message) => {
|
||||
var _a;
|
||||
if (message.method === "initialize") {
|
||||
(_a = clientTransport.onmessage) === null || _a === void 0 ? void 0 : _a.call(clientTransport, {
|
||||
jsonrpc: "2.0",
|
||||
id: message.id,
|
||||
result: {
|
||||
protocolVersion: LATEST_PROTOCOL_VERSION,
|
||||
capabilities: {},
|
||||
serverInfo: {
|
||||
name: "test",
|
||||
version: "1.0",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
return Promise.resolve();
|
||||
}),
|
||||
};
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
sampling: {},
|
||||
},
|
||||
});
|
||||
await client.connect(clientTransport);
|
||||
// Should have sent initialize with latest version
|
||||
expect(clientTransport.send).toHaveBeenCalledWith(expect.objectContaining({
|
||||
method: "initialize",
|
||||
params: expect.objectContaining({
|
||||
protocolVersion: LATEST_PROTOCOL_VERSION,
|
||||
}),
|
||||
}));
|
||||
});
|
||||
test("should initialize with supported older protocol version", async () => {
|
||||
const OLD_VERSION = SUPPORTED_PROTOCOL_VERSIONS[1];
|
||||
const clientTransport = {
|
||||
start: jest.fn().mockResolvedValue(undefined),
|
||||
close: jest.fn().mockResolvedValue(undefined),
|
||||
send: jest.fn().mockImplementation((message) => {
|
||||
var _a;
|
||||
if (message.method === "initialize") {
|
||||
(_a = clientTransport.onmessage) === null || _a === void 0 ? void 0 : _a.call(clientTransport, {
|
||||
jsonrpc: "2.0",
|
||||
id: message.id,
|
||||
result: {
|
||||
protocolVersion: OLD_VERSION,
|
||||
capabilities: {},
|
||||
serverInfo: {
|
||||
name: "test",
|
||||
version: "1.0",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
return Promise.resolve();
|
||||
}),
|
||||
};
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
sampling: {},
|
||||
},
|
||||
});
|
||||
await client.connect(clientTransport);
|
||||
// Connection should succeed with the older version
|
||||
expect(client.getServerVersion()).toEqual({
|
||||
name: "test",
|
||||
version: "1.0",
|
||||
});
|
||||
});
|
||||
test("should reject unsupported protocol version", async () => {
|
||||
const clientTransport = {
|
||||
start: jest.fn().mockResolvedValue(undefined),
|
||||
close: jest.fn().mockResolvedValue(undefined),
|
||||
send: jest.fn().mockImplementation((message) => {
|
||||
var _a;
|
||||
if (message.method === "initialize") {
|
||||
(_a = clientTransport.onmessage) === null || _a === void 0 ? void 0 : _a.call(clientTransport, {
|
||||
jsonrpc: "2.0",
|
||||
id: message.id,
|
||||
result: {
|
||||
protocolVersion: "invalid-version",
|
||||
capabilities: {},
|
||||
serverInfo: {
|
||||
name: "test",
|
||||
version: "1.0",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
return Promise.resolve();
|
||||
}),
|
||||
};
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
sampling: {},
|
||||
},
|
||||
});
|
||||
await expect(client.connect(clientTransport)).rejects.toThrow("Server's protocol version is not supported: invalid-version");
|
||||
expect(clientTransport.close).toHaveBeenCalled();
|
||||
});
|
||||
test("should respect server capabilities", async () => {
|
||||
const server = new Server({
|
||||
name: "test server",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
resources: {},
|
||||
tools: {},
|
||||
},
|
||||
});
|
||||
server.setRequestHandler(InitializeRequestSchema, (_request) => ({
|
||||
protocolVersion: LATEST_PROTOCOL_VERSION,
|
||||
capabilities: {
|
||||
resources: {},
|
||||
tools: {},
|
||||
},
|
||||
serverInfo: {
|
||||
name: "test",
|
||||
version: "1.0",
|
||||
},
|
||||
}));
|
||||
server.setRequestHandler(ListResourcesRequestSchema, () => ({
|
||||
resources: [],
|
||||
}));
|
||||
server.setRequestHandler(ListToolsRequestSchema, () => ({
|
||||
tools: [],
|
||||
}));
|
||||
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
sampling: {},
|
||||
},
|
||||
enforceStrictCapabilities: true,
|
||||
});
|
||||
await Promise.all([
|
||||
client.connect(clientTransport),
|
||||
server.connect(serverTransport),
|
||||
]);
|
||||
// Server supports resources and tools, but not prompts
|
||||
expect(client.getServerCapabilities()).toEqual({
|
||||
resources: {},
|
||||
tools: {},
|
||||
});
|
||||
// These should work
|
||||
await expect(client.listResources()).resolves.not.toThrow();
|
||||
await expect(client.listTools()).resolves.not.toThrow();
|
||||
// This should throw because prompts are not supported
|
||||
await expect(client.listPrompts()).rejects.toThrow("Server does not support prompts");
|
||||
});
|
||||
test("should respect client notification capabilities", async () => {
|
||||
const server = new Server({
|
||||
name: "test server",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {},
|
||||
});
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
roots: {
|
||||
listChanged: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
||||
await Promise.all([
|
||||
client.connect(clientTransport),
|
||||
server.connect(serverTransport),
|
||||
]);
|
||||
// This should work because the client has the roots.listChanged capability
|
||||
await expect(client.sendRootsListChanged()).resolves.not.toThrow();
|
||||
// Create a new client without the roots.listChanged capability
|
||||
const clientWithoutCapability = new Client({
|
||||
name: "test client without capability",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {},
|
||||
enforceStrictCapabilities: true,
|
||||
});
|
||||
await clientWithoutCapability.connect(clientTransport);
|
||||
// This should throw because the client doesn't have the roots.listChanged capability
|
||||
await expect(clientWithoutCapability.sendRootsListChanged()).rejects.toThrow(/^Client does not support/);
|
||||
});
|
||||
test("should respect server notification capabilities", async () => {
|
||||
const server = new Server({
|
||||
name: "test server",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
logging: {},
|
||||
resources: {
|
||||
listChanged: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {},
|
||||
});
|
||||
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
||||
await Promise.all([
|
||||
client.connect(clientTransport),
|
||||
server.connect(serverTransport),
|
||||
]);
|
||||
// These should work because the server has the corresponding capabilities
|
||||
await expect(server.sendLoggingMessage({ level: "info", data: "Test" })).resolves.not.toThrow();
|
||||
await expect(server.sendResourceListChanged()).resolves.not.toThrow();
|
||||
// This should throw because the server doesn't have the tools capability
|
||||
await expect(server.sendToolListChanged()).rejects.toThrow("Server does not support notifying of tool list changes");
|
||||
});
|
||||
test("should only allow setRequestHandler for declared capabilities", () => {
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
sampling: {},
|
||||
},
|
||||
});
|
||||
// This should work because sampling is a declared capability
|
||||
expect(() => {
|
||||
client.setRequestHandler(CreateMessageRequestSchema, () => ({
|
||||
model: "test-model",
|
||||
role: "assistant",
|
||||
content: {
|
||||
type: "text",
|
||||
text: "Test response",
|
||||
},
|
||||
}));
|
||||
}).not.toThrow();
|
||||
// This should throw because roots listing is not a declared capability
|
||||
expect(() => {
|
||||
client.setRequestHandler(ListRootsRequestSchema, () => ({}));
|
||||
}).toThrow("Client does not support roots capability");
|
||||
});
|
||||
/*
|
||||
Test that custom request/notification/result schemas can be used with the Client class.
|
||||
*/
|
||||
test("should typecheck", () => {
|
||||
const GetWeatherRequestSchema = RequestSchema.extend({
|
||||
method: z.literal("weather/get"),
|
||||
params: z.object({
|
||||
city: z.string(),
|
||||
}),
|
||||
});
|
||||
const GetForecastRequestSchema = RequestSchema.extend({
|
||||
method: z.literal("weather/forecast"),
|
||||
params: z.object({
|
||||
city: z.string(),
|
||||
days: z.number(),
|
||||
}),
|
||||
});
|
||||
const WeatherForecastNotificationSchema = NotificationSchema.extend({
|
||||
method: z.literal("weather/alert"),
|
||||
params: z.object({
|
||||
severity: z.enum(["warning", "watch"]),
|
||||
message: z.string(),
|
||||
}),
|
||||
});
|
||||
const WeatherRequestSchema = GetWeatherRequestSchema.or(GetForecastRequestSchema);
|
||||
const WeatherNotificationSchema = WeatherForecastNotificationSchema;
|
||||
const WeatherResultSchema = ResultSchema.extend({
|
||||
temperature: z.number(),
|
||||
conditions: z.string(),
|
||||
});
|
||||
// Create a typed Client for weather data
|
||||
const weatherClient = new Client({
|
||||
name: "WeatherClient",
|
||||
version: "1.0.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
sampling: {},
|
||||
},
|
||||
});
|
||||
// Typecheck that only valid weather requests/notifications/results are allowed
|
||||
false &&
|
||||
weatherClient.request({
|
||||
method: "weather/get",
|
||||
params: {
|
||||
city: "Seattle",
|
||||
},
|
||||
}, WeatherResultSchema);
|
||||
false &&
|
||||
weatherClient.notification({
|
||||
method: "weather/alert",
|
||||
params: {
|
||||
severity: "warning",
|
||||
message: "Storm approaching",
|
||||
},
|
||||
});
|
||||
});
|
||||
test("should handle client cancelling a request", async () => {
|
||||
const server = new Server({
|
||||
name: "test server",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
resources: {},
|
||||
},
|
||||
});
|
||||
// Set up server to delay responding to listResources
|
||||
server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
return {
|
||||
resources: [],
|
||||
};
|
||||
});
|
||||
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {},
|
||||
});
|
||||
await Promise.all([
|
||||
client.connect(clientTransport),
|
||||
server.connect(serverTransport),
|
||||
]);
|
||||
// Set up abort controller
|
||||
const controller = new AbortController();
|
||||
// Issue request but cancel it immediately
|
||||
const listResourcesPromise = client.listResources(undefined, {
|
||||
signal: controller.signal,
|
||||
});
|
||||
controller.abort("Cancelled by test");
|
||||
// Request should be rejected
|
||||
await expect(listResourcesPromise).rejects.toBe("Cancelled by test");
|
||||
});
|
||||
test("should handle request timeout", async () => {
|
||||
const server = new Server({
|
||||
name: "test server",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {
|
||||
resources: {},
|
||||
},
|
||||
});
|
||||
// Set up server with a delayed response
|
||||
server.setRequestHandler(ListResourcesRequestSchema, async (_request, extra) => {
|
||||
const timer = new Promise((resolve) => {
|
||||
const timeout = setTimeout(resolve, 100);
|
||||
extra.signal.addEventListener("abort", () => clearTimeout(timeout));
|
||||
});
|
||||
await timer;
|
||||
return {
|
||||
resources: [],
|
||||
};
|
||||
});
|
||||
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
||||
const client = new Client({
|
||||
name: "test client",
|
||||
version: "1.0",
|
||||
}, {
|
||||
capabilities: {},
|
||||
});
|
||||
await Promise.all([
|
||||
client.connect(clientTransport),
|
||||
server.connect(serverTransport),
|
||||
]);
|
||||
// Request with 0 msec timeout should fail immediately
|
||||
await expect(client.listResources(undefined, { timeout: 0 })).rejects.toMatchObject({
|
||||
code: ErrorCode.RequestTimeout,
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=index.test.js.map
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue