Skip to content

Commit e3a7c38

Browse files
committed
use the more common convention
1 parent cad1537 commit e3a7c38

File tree

28 files changed

+100
-94
lines changed

28 files changed

+100
-94
lines changed

epicshop/epic-me/app/routes/authorize.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ const AVAILABLE_SCOPES = [
104104
description: 'Modify your user profile information',
105105
},
106106
{
107-
value: 'read:entries',
107+
value: 'entries:read',
108108
label: 'Read Entries',
109109
description: 'View your journal entries',
110110
},
111111
{
112-
value: 'write:entries',
112+
value: 'entries:write',
113113
label: 'Write Entries',
114114
description: 'Create and modify journal entries',
115115
},
116-
{ value: 'read:tags', label: 'Read Tags', description: 'View your tags' },
116+
{ value: 'tags:read', label: 'Read Tags', description: 'View your tags' },
117117
{
118-
value: 'write:tags',
118+
value: 'tags:write',
119119
label: 'Write Tags',
120120
description: 'Create and modify tags',
121121
},

epicshop/epic-me/workers/app.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ const oauthProvider = new OAuthProvider({
2727
authorizeEndpoint: '/authorize',
2828
tokenEndpoint: '/token',
2929
clientRegistrationEndpoint: '/register',
30-
scopesSupported: ['read:entries', 'write:entries', 'read:tags', 'write:tags'],
30+
scopesSupported: [
31+
'user:read',
32+
'entries:read',
33+
'entries:write',
34+
'tags:read',
35+
'tags:write',
36+
],
3137
})
3238

3339
export default {

exercises/05.scopes/01.problem.check-scopes/src/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export async function resolveAuthInfo(
4949
}
5050
}
5151

52-
// 🐨 create a supportedScopes array with 'user:read', 'read:entries', 'write:entries', 'read:tags', 'write:tags'
52+
// 🐨 create a supportedScopes array with 'user:read', 'entries:read', 'entries:write', 'tags:read', 'tags:write'
5353
// 🐨 export a type representing those scopes
5454
// 💰 Here's the solution for that: export type SupportedScopes = (typeof supportedScopes)[number]
5555

exercises/05.scopes/01.problem.check-scopes/src/prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { type EpicMeMCP } from './index.ts'
55

66
export async function initializePrompts(agent: EpicMeMCP) {
77
// 🐨 wrap this prompt in an if statement so we only register the prompt if
8-
// the user has 'read:entries' and 'read:tags' scopes
8+
// the user has 'entries:read' and 'tags:read' scopes
99
agent.server.registerPrompt(
1010
'suggest_tags',
1111
{

exercises/05.scopes/01.problem.check-scopes/src/sampling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const resultSchema = z.object({
1010
})
1111

1212
export async function suggestTagsSampling(agent: EpicMeMCP, entryId: number) {
13-
// 🐨 exit early if the client does not have the required scopes of 'read:entries', 'read:tags', 'write:entries', 'write:tags'
13+
// 🐨 exit early if the client does not have the required scopes of 'entries:read', 'tags:read', 'entries:write', 'tags:write'
1414

1515
const clientCapabilities = agent.server.server.getClientCapabilities()
1616
if (!clientCapabilities?.sampling) {

exercises/05.scopes/01.solution.check-scopes/src/auth.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ export async function resolveAuthInfo(
5151

5252
const supportedScopes = [
5353
'user:read',
54-
'read:entries',
55-
'write:entries',
56-
'read:tags',
57-
'write:tags',
54+
'entries:read',
55+
'entries:write',
56+
'tags:read',
57+
'tags:write',
5858
] as const
5959
export type SupportedScopes = (typeof supportedScopes)[number]
6060

exercises/05.scopes/01.solution.check-scopes/src/prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { z } from 'zod'
44
import { type EpicMeMCP } from './index.ts'
55

66
export async function initializePrompts(agent: EpicMeMCP) {
7-
if (agent.hasScope('read:entries', 'read:tags')) {
7+
if (agent.hasScope('entries:read', 'tags:read')) {
88
agent.server.registerPrompt(
99
'suggest_tags',
1010
{

exercises/05.scopes/01.solution.check-scopes/src/sampling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const resultSchema = z.object({
1111

1212
export async function suggestTagsSampling(agent: EpicMeMCP, entryId: number) {
1313
if (
14-
!agent.hasScope('read:entries', 'read:tags', 'write:entries', 'write:tags')
14+
!agent.hasScope('entries:read', 'tags:read', 'entries:write', 'tags:write')
1515
) {
1616
console.error(
1717
'Client does not sufficient scopes to suggest tags, skipping sampling request',

exercises/05.scopes/02.problem.validate-sufficient-scope/src/auth.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ export async function resolveAuthInfo(
5151

5252
const supportedScopes = [
5353
'user:read',
54-
'read:entries',
55-
'write:entries',
56-
'read:tags',
57-
'write:tags',
54+
'entries:read',
55+
'entries:write',
56+
'tags:read',
57+
'tags:write',
5858
] as const
5959
export type SupportedScopes = (typeof supportedScopes)[number]
6060

@@ -72,10 +72,10 @@ export function validateScopes(
7272
// cases you may need more than one scope.
7373
const minimalValidScopeCombinations: Array<Array<SupportedScopes>> = [
7474
['user:read'],
75-
['read:entries'],
76-
['write:entries'],
77-
['read:tags'],
78-
['write:tags'],
75+
['entries:read'],
76+
['entries:write'],
77+
['tags:read'],
78+
['tags:write'],
7979
]
8080

8181
// 🧝‍♀️ I gave this one too you as well. Basically it just returns true if the

exercises/05.scopes/02.problem.validate-sufficient-scope/src/prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { z } from 'zod'
44
import { type EpicMeMCP } from './index.ts'
55

66
export async function initializePrompts(agent: EpicMeMCP) {
7-
if (agent.hasScope('read:entries', 'read:tags')) {
7+
if (agent.hasScope('entries:read', 'tags:read')) {
88
agent.server.registerPrompt(
99
'suggest_tags',
1010
{

0 commit comments

Comments
 (0)