Skip to content

Commit 2a57c84

Browse files
committed
add kody instructions
1 parent 9a59ff4 commit 2a57c84

File tree

2 files changed

+16
-1
lines changed
  • exercises
    • 01.advanced-tools/02.problem.structured/src
    • 05.changes/02.problem.resources-list-changed/src

2 files changed

+16
-1
lines changed

exercises/01.advanced-tools/02.problem.structured/src/tools.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ export async function initializeTools(agent: EpicMeMCP) {
384384
'If set to > 0, use mock mode and this is the mock wait time in milliseconds',
385385
),
386386
},
387+
// 🐨 add an outputSchema here with a video that is a videoSchema
387388
},
388389
async ({ year = new Date().getFullYear(), mockTime }) => {
389390
const entries = await agent.db.getEntries()
@@ -460,6 +461,9 @@ function createTagResourceLink(tag: {
460461
}
461462
}
462463

464+
// 💣 we now use structuredContent to return the contents of the resources with
465+
// resource links to share the URIs. Feel free to delete the embedded resource
466+
// utilities below.
463467
type ResourceContent = CallToolResult['content'][number]
464468

465469
function createEntryEmbeddedResource(entry: { id: number }): ResourceContent {

exercises/05.changes/02.problem.resources-list-changed/src/resources.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
import { invariant } from '@epic-web/invariant'
22
import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'
33
import { type EpicMeMCP } from './index.ts'
4-
import { getVideoBase64, listVideos } from './video.ts'
4+
import {
5+
getVideoBase64,
6+
listVideos,
7+
// 💰 you'll need this:
8+
// subscribe as subscribeToVideoChanges,
9+
} from './video.ts'
510

611
export async function initializeResources(agent: EpicMeMCP) {
12+
// 🐨 add a subscription to the database (💰 with agent.db.subscribe) that
13+
// passes a callback which calls agent.server.sendResourceListChanged.
14+
15+
// 🐨 add a subscription to the videos (💰 with subscribeToVideoChanges) that
16+
// passes a callback which calls agent.server.sendResourceListChanged.
17+
718
const tagListResource = agent.server.registerResource(
819
'tags',
920
'epicme://tags',

0 commit comments

Comments
 (0)