Repository navigation
Fix artist socials calls over full MCP OAuth - #1300
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
3 issues found across 3 files
Confidence score: 3/5
fullOAuthToolPolicy.tstells callers to use anaccount_id, butlist_artistsreturnsid; callers may fail to identify the artist account. Update the guidance to use the returnedidasartist_account_id.fullOAuthToolPolicy.tsandregisterFullOAuthTools.tsare both well over the 100-line limit, making the policy inventory and registration logic harder to maintain. Split them into smaller, focused modules.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/mcp/oauth/registerFullOAuthTools.ts">
<violation number="1" location="lib/mcp/oauth/registerFullOAuthTools.ts:110">
P2: Custom agent: **Enforce Clear Code Style and Maintainability Practices**
This module is 283 lines, well over Rule 3’s 100-line limit, and combines schema normalization, policy selection, authorization, and tool registration. Split these responsibilities into focused modules under the limit.</violation>
</file>
<file name="lib/mcp/oauth/fullOAuthToolPolicy.ts">
<violation number="1" location="lib/mcp/oauth/fullOAuthToolPolicy.ts:47">
P2: Custom agent: **Enforce Clear Code Style and Maintainability Practices**
This policy file is 239 lines, well above the rule’s 100-line limit, and this entry expands it further. Split the policy inventory into smaller modules.</violation>
<violation number="2" location="lib/mcp/oauth/fullOAuthToolPolicy.ts:47">
P2: Custom agent: **Flag AI Slop and Fabricated Changes**
`list_artists` returns each artist as `{ id, name }`, not with an `account_id` field. Tell callers to use the returned `id` as `artist_account_id`.</violation>
</file>
Architecture diagram
sequenceDiagram
participant Client as MCP Client
participant SDK as MCP SDK
participant Adapter as OAuth Adapter (registerFullOAuthTools)
participant Policy as Tool Policy (fullOAuthToolPolicy)
participant Handler as Tool Handler (getArtistSocials)
participant Data as Data Layer (Supabase)
Note over Client,Data: get_artist_socials via Full MCP OAuth
Client->>SDK: Call get_artist_socials with args
SDK->>Adapter: Invoke registered tool
Adapter->>Adapter: Normalize input schema
alt Raw Zod shape (e.g. field map)
Adapter->>Adapter: Wrap in z.object() for validation
else Object schema
Adapter->>Adapter: Use as-is
end
Adapter->>Adapter: Validate and parse args (z.object().parse())
alt Valid args
Adapter->>Policy: Check tool policy
Policy-->>Adapter: readOnly, openWorld=false, notice
alt Ownership check
Adapter->>Adapter: Verify account_id belongs to connected owner
alt Owned account
Adapter->>Handler: Execute getArtistSocials({ artist_account_id, page, limit, history })
Handler->>Data: Query artist socials
Data-->>Handler: Profile with socials + pagination
Handler-->>Adapter: Return profile
Adapter-->>SDK: CallToolResult (success)
SDK-->>Client: Socials profile
else Unauthorized account
Adapter-->>SDK: Error (access denied)
SDK-->>Client: Tool error
end
end
else Invalid args
Adapter-->>SDK: Validation error
SDK-->>Client: Invalid arguments
end
Note over Client: Caller should use artist_account_id from list_artists
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| @@ -36,7 +36,11 @@ export function registerFullOAuthTools( | |||
| ) { | |||
There was a problem hiding this comment.
P2: Custom agent: Enforce Clear Code Style and Maintainability Practices
This module is 283 lines, well over Rule 3’s 100-line limit, and combines schema normalization, policy selection, authorization, and tool registration. Split these responsibilities into focused modules under the limit.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At lib/mcp/oauth/registerFullOAuthTools.ts, line 110:
<comment>This module is 283 lines, well over Rule 3’s 100-line limit, and combines schema normalization, policy selection, authorization, and tool registration. Split these responsibilities into focused modules under the limit.</comment>
<file context>
@@ -102,13 +106,15 @@ export function registerFullOAuthTools(
- const originalObject =
- config.inputSchema instanceof z.ZodObject ? config.inputSchema : undefined;
+ // The MCP SDK accepts raw Zod shapes. The OAuth adapter also parses them itself.
+ const registeredSchema =
+ config.inputSchema instanceof z.ZodType ? config.inputSchema : z.object(config.inputSchema);
+ const originalObject = registeredSchema instanceof z.ZodObject ? registeredSchema : undefined;
</file context>
| readOnly: true, | ||
| destructive: false, | ||
| openWorld: false, | ||
| notice: "Use the artist account_id returned by list_artists as artist_account_id.", |
There was a problem hiding this comment.
P2: Custom agent: Enforce Clear Code Style and Maintainability Practices
This policy file is 239 lines, well above the rule’s 100-line limit, and this entry expands it further. Split the policy inventory into smaller modules.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At lib/mcp/oauth/fullOAuthToolPolicy.ts, line 47:
<comment>This policy file is 239 lines, well above the rule’s 100-line limit, and this entry expands it further. Split the policy inventory into smaller modules.</comment>
<file context>
@@ -40,7 +40,12 @@ export const fullOAuthToolPolicy: Record<string, ToolPolicy> = {
+ readOnly: true,
+ destructive: false,
+ openWorld: false,
+ notice: "Use the artist account_id returned by list_artists as artist_account_id.",
+ },
artist_deep_research: { readOnly: true, destructive: false, openWorld: false },
</file context>
| readOnly: true, | ||
| destructive: false, | ||
| openWorld: false, | ||
| notice: "Use the artist account_id returned by list_artists as artist_account_id.", |
There was a problem hiding this comment.
P2: Custom agent: Flag AI Slop and Fabricated Changes
list_artists returns each artist as { id, name }, not with an account_id field. Tell callers to use the returned id as artist_account_id.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At lib/mcp/oauth/fullOAuthToolPolicy.ts, line 47:
<comment>`list_artists` returns each artist as `{ id, name }`, not with an `account_id` field. Tell callers to use the returned `id` as `artist_account_id`.</comment>
<file context>
@@ -40,7 +40,12 @@ export const fullOAuthToolPolicy: Record<string, ToolPolicy> = {
+ readOnly: true,
+ destructive: false,
+ openWorld: false,
+ notice: "Use the artist account_id returned by list_artists as artist_account_id.",
+ },
artist_deep_research: { readOnly: true, destructive: false, openWorld: false },
</file context>
| notice: "Use the artist account_id returned by list_artists as artist_account_id.", | |
| + notice: "Use the artist id returned by list_artists as artist_account_id.", |
Summary
Full OAuth now wraps raw registered Zod field maps in an object schema before its own validation.
get_artist_socialswas discoverable because the MCP SDK accepts a field map, but execution failed before the ownership check because that map has no.parse()method. The tool description now points callers to the artistaccount_idreturned bylist_artists.Evidence
Merge Danger
Door Two-way. The fix changes schema normalization in the full OAuth adapter. Existing object and discriminated-union schemas, ownership checks, scopes and tool handlers are retained.
Summary by cubic
Fixes
get_artist_socialsfailing under full MCP OAuth. The SDK accepts raw Zod field maps, but the OAuth adapter needs an object schema to validate and parse arguments, so execution failed before the ownership check. The fix wraps raw shapes inz.object()during registration, and the tool notice now points callers to the artistaccount_idreturned bylist_artists.Written for commit 0dcca78. Summary will update on new commits.