Commit graph typescript-sdk/src/types.ts
Author SHA1 Message Date
Nathan Arseneau
9f5b4bf00d Add audio content 2025-04-01 19:01:22 -04:00
Justin Spahr-Summers
f6e47c4751
Add missing name to McpError 2025-02-18 14:15:22 +00:00
Kalvin Chau
443c0829ed feat: add mcp client instruction support 2025-01-22 09:17:59 -08:00
Justin Spahr-Summers
0c5d6c4f18
Missed one 2025-01-06 21:37:30 +00:00
Justin Spahr-Summers
b5711be1ad
Can just reuse z.infer instead of using ReturnType 2025-01-03 14:01:17 +00:00
Justin Spahr-Summers
73ea68cf13
Disable ESLint warning 2025-01-03 13:49:07 +00:00
Justin Spahr-Summers
9b5efc4286
Recursively flatten types for better inference 2025-01-03 13:47:19 +00:00
Sumitesh Naithani
21e3d465ca chore: updated documentation comment in ErrorCode enum and set protocol test timeout to 0 2025-01-03 06:59:01 +05:30
Sumitesh Naithani
d77cd0deb3 style: fixed linting issues 2024-12-22 23:20:35 +05:30
Sumitesh Naithani
e7d08c738e fix(protocol): restrict SDK error codes to JSON-RPC server error range
The SDK's custom error codes were previously using arbitrary negative numbers
(-1, -2) which could conflict with application-specific error codes. This change:

- Updates ConnectionClosed from -1 to -32000
- Updates RequestTimeout from -2 to -32001
- Keeps standard JSON-RPC error codes unchanged
- Adds documentation explaining the server error range usage

This modification ensures compliance with the JSON-RPC 2.0 specification, which
reserves -32000 to -32099 for implementation-defined server errors. This change
allows applications to freely use other error code ranges without potential
conflicts with SDK-generated errors.

Issue: #85
2024-12-22 23:12:22 +05:30
Justin Spahr-Summers
1962943b22
Revert "Remove CompatibilityCallToolResult" 2024-12-04 17:09:31 +00:00
Justin Spahr-Summers
e911ece970
Remove CompatibilityCallToolResult
Resolves #82.
2024-12-03 16:03:26 +00:00
Justin Spahr-Summers
2cc3bc8a40
Add RequestOptions.timeout 2024-11-16 16:30:20 +00:00
Justin Spahr-Summers
15bd2dc7aa
Fix cancelled notification method name 2024-11-14 14:07:16 +00:00
Justin Spahr-Summers
347e8905a9
Add types for cancellation notifications 2024-11-14 13:39:43 +00:00
Justin Spahr-Summers
d0c83e946c
Fix notification params schemas not permitting _meta 2024-11-14 13:26:24 +00:00
Justin Spahr-Summers
002f82332d
Merge branch 'main' into justin/call-tool-iserror 2024-11-12 13:47:43 +00:00
Justin Spahr-Summers
dc45f5d148
Handle capabilities checks at the request() level, make non-strict by default 2024-11-12 10:57:59 +00:00
Justin Spahr-Summers
7631cdb6d1
CallToolResult.isError should not be required 2024-11-11 21:27:02 +00:00
Justin Spahr-Summers
2b7a23bb81
Fix some missing type exports 2024-11-10 13:50:10 +00:00
Justin Spahr-Summers
68ef1f9f52
Prevent new server code from returning toolResult
This doesn't impact the ability of clients to handle it (see `Client.callTool`), but does make it a type error to return the old format. This will make it easier to catch sites that haven't been updated.
2024-11-08 16:12:55 +00:00
Justin Spahr-Summers
5c6a7a247e
CallToolResult.isError should be optional 2024-11-07 13:36:57 +00:00
Justin Spahr-Summers
1f3dbef66c
Support old tools/call result structure, if explicitly opted in 2024-11-07 13:09:20 +00:00
Justin Spahr-Summers
b618157c93
Continue allowing 2024-10-07 in version negotiation 2024-11-07 13:00:52 +00:00
Justin Spahr-Summers
0bf7e66e98
Require protocolVersion to be a string now 2024-11-07 12:57:19 +00:00
Justin Spahr-Summers
f74a289211
Split out ModelHintSchema for better typing and docs 2024-11-06 11:56:20 +00:00
Justin Spahr-Summers
f7f0ccff0e
Declare known stopReasons, as a kind of documentation 2024-11-06 11:56:05 +00:00
Justin Spahr-Summers
45a4c9ee37
List roots is not a client request 2024-11-06 11:45:19 +00:00
Justin Spahr-Summers
579ac51f21
Export type aliases for roots 2024-11-06 11:44:37 +00:00
Justin Spahr-Summers
ce50ba4915
Fix resources/templates/list not being included in client/server schemas 2024-11-06 11:42:09 +00:00
Justin Spahr-Summers
7e085d0519
Update for spec changes 2024-11-06 11:38:02 +00:00
Justin Spahr-Summers
bcf9862937
progressToken should be required in progress notifications 2024-11-04 20:50:27 +00:00
Justin Spahr-Summers
f02952aa81
Fix paginated requests requiring params
Resolves #21.
2024-11-04 20:50:23 +00:00
Justin Spahr-Summers
ee7eb5e5c9
Make most object types pass through unrecognized properties 2024-10-21 12:32:41 +01:00
Justin Spahr-Summers
209f8eb1c0
Revert string -> URL transformations 2024-10-18 17:53:01 +01:00
Ashwin Bhat
65a861328b
fix schema definitions for RequestSchema 2024-10-16 15:30:24 -07:00
Justin Spahr-Summers
ec96ffc958
Treat URIs as 'URL' type 2024-10-11 16:02:24 +01:00
Justin Spahr-Summers
69daade659
Update to latest protocol version 2024-10-11 14:01:35 +01:00
Justin Spahr-Summers
8b476ddc85
Start JSON-RPC messages with 'jsonrpc' and 'id' fields, instead of the other way around 2024-10-02 22:22:00 +01:00
Justin Spahr-Summers
cc1f19a051
Allow messages to contain other protocol versions 2024-10-02 14:51:56 +01:00
Justin Spahr-Summers
d5c3d8178e
Add TypeScript types from Zod schemas 2024-10-02 14:51:56 +01:00
Justin Spahr-Summers
cd6820e810
Use an enum for error codes 2024-10-02 14:51:55 +01:00
Justin Spahr-Summers
4be31d0f08
Remove explicit constants of method names, factor out ProgressSchema 2024-10-02 14:51:55 +01:00
Justin Spahr-Summers
0e2b156a7d
More fixups, including object property passthroughs 2024-10-02 14:42:15 +01:00
Justin Spahr-Summers
e929a4bf67
Reorder definitions to eliminate use of lazy() 2024-10-02 14:32:04 +01:00
Justin Spahr-Summers
b400ce5782
Mark numbers as integers where possible 2024-10-02 14:22:42 +01:00
Justin Spahr-Summers
c7713e9d61
Fix up URIs 2024-10-02 14:21:25 +01:00
Justin Spahr-Summers
8488d56810
Claude rewriting types as Zod schemas 2024-10-02 14:20:31 +01:00
Justin Spahr-Summers
3786c88960
Combine types into one file 2024-10-02 14:17:31 +01:00
Renamed from src/types/schema.ts (Previous history)