Skip to main content
Glama
jfrog

JFrog MCP Server

Official
by jfrog

jfrog_replace_permission_resource

Replace a specific resource type within a permission target in JFrog MCP Server. Update actions and patterns for users or groups to manage access permissions effectively.

Instructions

Replace a specific resource type within a permission target

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the permission target
resourceYes
resourceTypeYesThe type of resource to replace

Implementation Reference

  • Core handler function that sends a PUT request to the JFrog API to replace the specified permission resource and parses the response based on resource type.
    export async function replacePermissionResource( name: string, resourceType: "artifact" | "release_bundle" | "build", resource: z.infer<typeof ArtifactResourceSchema> | z.infer<typeof ReleaseBundleResourceSchema> | z.infer<typeof BuildResourceSchema> ) { const response = await jfrogRequest(`/access/api/v2/permissions/${name}/${resourceType}`, { method: "PUT", body: resource }); switch (resourceType) { case "artifact": return ArtifactResourceSchema.parse(response); case "release_bundle": return ReleaseBundleResourceSchema.parse(response); case "build": return BuildResourceSchema.parse(response); } }
  • Tool registration object that defines the MCP tool 'jfrog_replace_permission_resource', including input schema, description, and handler wrapper.
    const replacePermissionResourceTool = { name: "jfrog_replace_permission_resource", description: "Replace a specific resource type within a permission target", inputSchema: zodToJsonSchema(z.object({ name: z.string().describe("The name of the permission target"), resourceType: z.enum(["artifact", "release_bundle", "build"]).describe("The type of resource to replace"), resource: z.union([ArtifactResourceSchema, ReleaseBundleResourceSchema, BuildResourceSchema]) })), //outputSchema: zodToJsonSchema(z.union([ArtifactResourceSchema, ReleaseBundleResourceSchema, BuildResourceSchema])), handler: async (args: any) => { return await replacePermissionResource(args.name, args.resourceType, args.resource); } };
  • The replacePermissionResourceTool is included in the PermissionsTools array, which collects all permission-related tools.
    export const PermissionsTools = [ listPermissionTargetsTool, getPermissionTargetTool, createPermissionTargetTool, updatePermissionTargetTool, deletePermissionTargetTool, getPermissionResourceTool, updatePermissionResourceTool, replacePermissionResourceTool, deletePermissionResourceTool ];
  • tools/index.ts:13-23 (registration)
    PermissionsTools (containing jfrog_replace_permission_resource) is spread into the main global tools array for final registration.
    export const tools =[ ...RepositoryTools, ...BuildsTools, ...RuntimeTools, ...AccessTools, ...AQLTools, ...CatalogTools, ...CurationTools, ...PermissionsTools, ...ArtifactSecurityTools, ];
  • Zod schemas defining the structure of permission resources (ArtifactResourceSchema, ReleaseBundleResourceSchema, BuildResourceSchema) used in the tool's input and output.
    const ResourceTargetSchema = z.object({ include_patterns: z.array(z.string()), exclude_patterns: z.array(z.string()) }); const ResourceActionsSchema = z.object({ users: z.record(z.array(z.enum([ "READ", "WRITE", "ANNOTATE", "DELETE", "DISTRIBUTE", "MANAGE" ]))), groups: z.record(z.array(z.enum([ "READ", "WRITE", "ANNOTATE", "DELETE", "DISTRIBUTE", "MANAGE" ]))).default({}).describe("The actions that the group can perform on the resource") }); const ArtifactResourceSchema = z.object({ actions: ResourceActionsSchema, targets: z.record(ResourceTargetSchema) }); const ReleaseBundleResourceSchema = z.object({ actions: ResourceActionsSchema, targets: z.record(ResourceTargetSchema) }); const BuildResourceSchema = z.object({ actions: ResourceActionsSchema, targets: z.record(ResourceTargetSchema) }); const PermissionTargetSchema = z.object({ name: z.string(), resources: z.object({ artifact: ArtifactResourceSchema.optional(), release_bundle: ReleaseBundleResourceSchema.optional(), build: BuildResourceSchema.optional() }), created_by: z.string().optional(), modified_by: z.string().optional() });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jfrog/mcp-jfrog'

If you have feedback or need assistance with the MCP directory API, please join our Discord server