Commit graph typescript-sdk/src/server/mcp.test.ts
Author SHA1 Message Date
bhosmer-ant
a40b353fb6
Merge branch 'main' into feat/structured-content-with-type-safety 2025-06-30 10:08:09 -04:00
Inna Harper
7682c4cf4f
Merge pull request #598 from sinedied/fix-empty-schema
fix: missing "properties" property in empty schema
2025-06-30 13:20:42 +01:00
Konstantin Konstantinov
606c278668
clean up tests - remove mockRequestInfo 2025-06-25 16:24:30 +03:00
Konstantin Konstantinov
33895f4520
Merge branch 'main' into request-propagation-in-tools 2025-06-24 19:32:49 +03:00
ihrpr
33e03f499e
Merge branch 'main' into fix/skip_validate_if_error 2025-06-24 17:12:34 +01:00
ihrpr
c20a47a79f
small fixes 2025-06-24 17:09:29 +01:00
Konstantin Konstantinov
96ff8573cf
Merge branch 'main' into request-propagation-in-tools 2025-06-24 17:21:09 +03:00
sushichan044
08808a45e0
test: add type assertion to bypass type check 2025-06-20 17:24:17 +09:00
sushichan044
fc9ca5ff2e
fix: update ToolCallback type to include output arguments for better type safety 2025-06-20 16:47:53 +09:00
ihrpr
e7a5e331f1
rename decline to reject 2025-06-18 20:11:18 +01:00
joeyzzeng
e76faf6a18 fix: skip validation if tool reports error 2025-06-18 21:34:42 +08:00
ihrpr
54c30109fb
Merge branch 'main' into ihrpr/elicitation 2025-06-16 19:11:57 +01:00
Konstantin Konstantinov
71abccb874
Merge branch 'main' into request-propagation-in-tools 2025-06-16 18:51:44 +03:00
ihrpr
0e86a6d139
improve readme 2025-06-16 14:36:35 +01:00
ihrpr
42c3967d8b
add to readme 2025-06-16 14:23:17 +01:00
ihrpr
c90d6c9853
add context with arguments to completable 2025-06-16 14:11:10 +01:00
ihrpr
d1c94a2c69
refactor 2025-06-16 10:43:31 +01:00
Konstantin Konstantinov
e714050642
Merge branch 'main' into request-propagation-in-tools 2025-06-14 01:10:58 +03:00
Konstantin Konstantinov
db9ba7b419
raw request propagation in tools - implementation, unit tests, types 2025-06-14 01:08:02 +03:00
bhosmer-ant
b6f0273569
Merge pull request #621 from modelcontextprotocol/carlpeaslee/fix-resource-template-list-metadata
Adding tests to prevent regressions for: fixes metadata for listed resources from resource templates so that they favor their own metadata
2025-06-12 13:53:43 -04:00
ihrpr
bc5312991e
adding tests to prevent regressions 2025-06-12 18:47:16 +01:00
ihrpr
c088719985
tests 2025-06-10 17:26:48 +01:00
ihrpr
2d61b4b8fc
adding README 2025-06-10 15:52:20 +01:00
sinedied
921ce70fa3 fix: missing "properties" property in empty schema 2025-06-09 14:17:53 +02:00
Frédéric Barthelet
7e0521550b Add tests for completions capability registration on template resource with completion or prompt completable argument registration 2025-05-25 19:07:26 -07:00
Frédéric Barthelet
269c8caf8e Remove server-specific capabilities definition from Client constructor in mcp tests 2025-05-25 18:00:28 -07:00
Basil Hosmer
aeb7b8d741
server error if tool declares outputSchema but no structuredContent in result 2025-05-21 15:45:52 -04:00
Basil Hosmer
7636c63f39
update to track spec changes 2025-05-21 12:42:20 -04:00
ihrpr
265ad071f7
make content required 2025-05-21 12:19:31 -04:00
Basil Hosmer
d37de9b110
Add support for message field in progress notifications
Implements the new optional message field for progress notifications as
defined in the MCP specification update. This allows servers to provide
descriptive status updates alongside progress values.

Changes:
- Add optional message field to ProgressSchema in types.ts
- Add tests for progress notifications with message field
- Update protocol tests to verify message field handling

Refs: https://github.com/modelcontextprotocol/modelcontextprotocol/pull/197

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-16 15:18:28 -04:00
Basil Hosmer
712b04e96d
Refactor McpServer tool registration API
- Remove tool() overload that takes a config object with callback
- Add new registerTool() method that separates config from callback
- Extract common tool registration logic into _createRegisteredTool() helper
- Update all tests to use registerTool() for tools with output schemas
- Update examples to use registerTool() and high-level Client API
- Add comment noting that output schema validation only works with high-level API

This change improves API clarity by using a distinct method for tools with
output schemas while maintaining backward compatibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-15 10:03:50 -04:00
Basil Hosmer
0fa3277550
avoid ({}) => ... in tests 2025-05-15 10:03:50 -04:00
Basil Hosmer
6079cd8307
- add new tool() api and tests
- fix schema validation
- comment headers on tests
2025-05-15 10:03:02 -04:00
Basil Hosmer
9686fc2ead
formatting, more version rollbacks 2025-05-15 10:02:03 -04:00
Basil Hosmer
bb28098d81
feat: add server-side support for tool outputSchema with backward compatibility
- Update McpServer to support registering tools with outputSchema
- Add automatic content generation from structuredContent for backward compatibility
- Add validation to ensure proper usage of structuredContent vs content
- Add comprehensive tests for outputSchema functionality
- Add example servers demonstrating structured output usage
- Update existing test to match new backward compatibility behavior

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-15 10:02:02 -04:00
Basil Hosmer
882e0b7d05
feat: update TypeScript SDK to implement draft spec changes for structured tool output
- Add outputSchema support to Tool interface with proper documentation
- Split CallToolResult into structured and unstructured variants
- Change structuredContent from string to object type
- Add validation that tools without outputSchema cannot return structuredContent
- Add validation that tools with outputSchema must return structuredContent
- Update client to validate structured content as object (no JSON parsing)
- Update tests to use object format for structuredContent
- Add tests for new validation constraints
- Update LATEST_PROTOCOL_VERSION to DRAFT-2025-v2

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-15 10:02:02 -04:00
Basil Hosmer
a85fee407a
Add support for outputSchema and optional content fields in tools
- Add outputSchema field to Tool type and RegisteredTool interface
- Make content field optional in CallToolResult
- Update ListToolsRequestSchema handler to include outputSchema in tool list responses
- Add support for structuredContent in tool results
- Update examples to handle optional content field
- Add tests for new outputSchema and structuredContent functionality
- Update ToolCallback documentation to clarify when to use structuredContent vs content

This change enables tools to define structured output schemas and return
structured JSON content, providing better type safety and validation for
tool outputs.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-15 09:58:40 -04:00
yuna0x0
52dc7f1160
Fix isZodRawShape return false on empty object and add test 2025-05-06 01:49:33 +08:00
Basil Hosmer
e53608ea19
rebase and address comments 2025-04-22 16:37:16 -04:00
Basil Hosmer
0096be432f
Add ToolAnnotations support to McpServer.tool() method 2025-04-22 15:24:32 -04:00
Luca Forstner
ec23b71f4e
Pass requestId to handlers via metadata 2025-04-17 11:41:11 +02:00
Glen Maddern
9f9c244857 Added mutation methods to RegisteredTool/Resource/ResourceTemplate/Prompt
This allows these objects to be enabled/disabled, or updated on the fly. Corresponding listChanged notifications are automatically emitted.
2025-04-09 15:55:49 +10:00
ihrpr
af64a0e18c
remove custom headers 2025-04-07 16:03:31 +01:00
ihrpr
251bb9d97d
Merge branch 'main' into ihrpr/http-streamable-server 2025-04-07 14:29:09 +01:00
Justin Spahr-Summers
8027ae1593
Revert "feat: support extending McpServer with authorization" 2025-04-07 10:47:37 +01:00
ihrpr
873f51f4ac
Merge branch 'main' into ihrpr/http-streamable-server 2025-04-06 17:39:40 +01:00
ihrpr
b0697195a7
add test to cover nested logging withing a tool call 2025-04-06 16:09:15 +01:00
ihrpr
bafd9e74f3
Add ways to associate related requests and notifications 2025-04-05 19:52:29 +01:00
wangshijun
473dc6cad5 chore: add test case for McpServer with auth 2025-04-05 11:33:40 +08:00
Jason Victor
c396b4af1d added test for session id using in memory transport 2025-02-25 17:57:45 -05:00