Title: feat(server): tool call support context by taobaorun · Pull Request #172 · modelcontextprotocol/java-sdk · GitHub
Open Graph Title: feat(server): tool call support context by taobaorun · Pull Request #172 · modelcontextprotocol/java-sdk
X Title: feat(server): tool call support context by taobaorun · Pull Request #172 · modelcontextprotocol/java-sdk
Description: Motivation and Context
Current call tool flow can't get some information about the request.for example the header value
handle with context (map)
context has the current original request. e.g. ServerRequest
has the current sessionId
if has the context,the tool method can get more information.
@Tool(description = "Get the current date and time in the user's timezone")
String getCurrentDateTime(@ToolParam(required = false) ToolContext context) {
context.getContext().get("sessionId")
return LocalDateTime.now().atZone(LocaleContextHolder.getTimeZone().toZoneId()).toString();
}
public class RequestContext {
/**
* the original request object
*/
private Object request;
private final Map
Open Graph Description: Motivation and Context Current call tool flow can't get some information about the request.for example the header value handle with context (map) context has the current original request. e....
X Description: Motivation and Context Current call tool flow can't get some information about the request.for example the header value handle with context (map) context has the current original request...
Opengraph URL: https://github.com/modelcontextprotocol/java-sdk/pull/172
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:d5649d96-d5c8-623a-c1d6-dbea21d53cd7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8D2C:15BE83:1C7EDC:26E52C:6A5A5A81 |
| html-safe-nonce | 8d10fca1386399e706366db493a13057eda3abe80386202fd2f305abadf30926 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDJDOjE1QkU4MzoxQzdFREM6MjZFNTJDOjZBNUE1QTgxIiwidmlzaXRvcl9pZCI6IjU3MDgxNDQ3NzY2NDM3NjI4MTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8513c821d9af3819905a4d56cf7c33d7e53d2038420e7014912aa574863faee5 |
| hovercard-subject-tag | pull_request:2466666527 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelcontextprotocol/java-sdk/pull/172/files |
| twitter:image | https://avatars.githubusercontent.com/u/2045309?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/2045309?s=400&v=4 |
| og:image:alt | Motivation and Context Current call tool flow can't get some information about the request.for example the header value handle with context (map) context has the current original request. e.... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 05b9ddf6a47d2dbe13944873a99f5fb4b83ba4871f9cb8a8e256793a63ca9687 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelcontextprotocol/java-sdk git https://github.com/modelcontextprotocol/java-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 919609219 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/java-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 919609219 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/java-sdk |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f8d29d1bd03dda2dd14b3f80b8bc27e1111f43bd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width