|
29 | 29 | /// ### MCP Development Guide |
30 | 30 | /// `McpService` lets you expose functionality over the MCP protocol (only simple http for now). This allows external |
31 | 31 | /// chat sessions to pull information from LabKey Server. Exposed functionality is also made available to chat sessions |
32 | | -/// hosted by LabKey (see `AbstractAgentAction``). |
| 32 | +/// hosted by LabKey (see `AbstractAgentAction`). |
33 | 33 | /// |
34 | 34 | /// ### Adding a new MCP class |
35 | 35 | /// 1. Create a new class that implements `McpImpl` (see below) in the appropriate module |
36 | | -/// 2. Register that class in your module `init()` method: `McpService.get().register(new MyMcp())` |
| 36 | +/// 2. Register that class in your module's `startup()` method: `McpService.get().register(new MyMcp())` |
37 | 37 | /// 3. Add tools and resources |
38 | 38 | /// |
39 | 39 | /// ### Adding a new MCP tool |
|
44 | 44 | /// permission annotation is required, otherwise your tool will not be registered.** |
45 | 45 | /// 4. Add `ToolContext` as the first parameter to the method |
46 | 46 | /// 5. Add additional required or optional parameters to the method signature, as needed. Note that "required" is the |
47 | | -/// default. Again here, the parameter descriptions are very important. Provide examples. |
| 47 | +/// default. Again here, the parameter descriptions are very important. Provide examples of parameter values. |
48 | 48 | /// 6. Use the helper method `getContext(ToolContext)` to retrieve the current `Container` and `User` |
49 | 49 | /// 7. Use the helper method `getUser(ToolContext)` in the rare cases where you need just a `User` |
50 | 50 | /// 8. Perform additional permissions checking (beyond what the annotations offer), where appropriate |
51 | 51 | /// 9. Filter all results to the current container, of course |
52 | 52 | /// 10. For any error conditions, throw exceptions with detailed information. These will get translated into appropriate |
53 | | -/// failure responses and the LLM client will attempt to correct the problem. |
| 53 | +/// failure responses and the LLM client will attempt to correct any problems (hopefully). |
54 | 54 | /// 11. For success cases, return a String with a message or JSON content, for example, `JSONObject.toString()`. Spring |
55 | 55 | /// has some limited ability to convert other objects into JSON strings, but we haven't experimented with that. See |
56 | 56 | /// `DefaultToolCallResultConverter` and the ability to provide a custom result converter via the `@Tool` annotation. |
@@ -126,6 +126,7 @@ static void setInstance(McpService service) |
126 | 126 |
|
127 | 127 | boolean isReady(); |
128 | 128 |
|
| 129 | + // Register MCPs in Module.startup() |
129 | 130 | default void register(McpImpl mcp) |
130 | 131 | { |
131 | 132 | try |
|
0 commit comments