Repository navigation
Fix artist socials calls over full MCP OAuth #1300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,7 +40,12 @@ export const fullOAuthToolPolicy: Record<string, ToolPolicy> = { | |||||
| get_artist_posts: { readOnly: true, destructive: false, openWorld: false }, | ||||||
| get_scraper_results: { readOnly: true, destructive: false, openWorld: false }, | ||||||
| scrape_artist_socials: { readOnly: false, destructive: true, openWorld: true }, | ||||||
| get_artist_socials: { readOnly: true, destructive: false, openWorld: false }, | ||||||
| get_artist_socials: { | ||||||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Custom agent: Flag AI Slop and Fabricated Changes
Prompt for AI agents
Suggested change
|
||||||
| }, | ||||||
| artist_deep_research: { readOnly: true, destructive: false, openWorld: false }, | ||||||
| spotify_deep_research: { readOnly: true, destructive: false, openWorld: false }, | ||||||
| get_spotify_album: { readOnly: true, destructive: false, openWorld: true }, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,11 @@ export function registerFullOAuthTools( | |
| ) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
| const register = ( | ||
| name: string, | ||
| config: { description?: string; inputSchema: z.ZodType; annotations?: Record<string, unknown> }, | ||
| config: { | ||
| description?: string; | ||
| inputSchema: z.ZodType | z.ZodRawShape; | ||
| annotations?: Record<string, unknown>; | ||
| }, | ||
| handler: (args: Args, extra: Extra) => Promise<CallToolResult>, | ||
| operation?: { | ||
| name: string; | ||
|
|
@@ -102,13 +106,15 @@ export function registerFullOAuthTools( | |
| } | ||
| : fullOAuthToolPolicy[name]; | ||
| if (!policy) throw new Error(`Missing delegated policy for ${name}`); | ||
| 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; | ||
| // External agents need not create a Recoup chat merely to send an email. | ||
| const sourceSchema = | ||
| name === "send_email" && originalObject | ||
| ? originalObject.extend({ room_id: originalObject.shape.room_id.optional() }) | ||
| : config.inputSchema; | ||
| : registeredSchema; | ||
| const object = sourceSchema instanceof z.ZodObject ? sourceSchema : undefined; | ||
| const hasOwner = !!object && "account_id" in object.shape; | ||
| const inputSchema = object | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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