github_code_security_create_configuration_for_enterprise
Create a code security configuration for an enterprise to enforce security policies across all repositories.
Instructions
Create a code security configuration for an enterprise
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| enterprise | Yes | enterprise | |
| body | No | Request body (JSON object) |
Implementation Reference
- src/tools/code-security.ts:1-242 (registration)The codeSecurityTools array is exported from this file and later registered via server.tool() in src/index.ts. It contains the tool definition.
// AUTO-GENERATED by scripts/generate.ts — DO NOT EDIT import { z } from "zod"; import { githubRequest } from "../client.js"; export const codeSecurityTools = [ { name: "github_code_security_get_configurations_for_enterprise", description: "Get code security configurations for an enterprise", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), per_page: z.number().optional().describe("The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), before: z.string().optional().describe("A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), after: z.string().optional().describe("A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/enterprises/${args.enterprise}/code-security/configurations`, undefined, { per_page: args.per_page, before: args.before, after: args.after }); }, }, { name: "github_code_security_create_configuration_for_enterprise", description: "Create a code security configuration for an enterprise", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("POST", `/enterprises/${args.enterprise}/code-security/configurations`, args.body, undefined); }, }, { name: "github_code_security_get_default_configurations_for_enterprise", description: "Get default code security configurations for an enterprise", inputSchema: z.object({ enterprise: z.string().describe("enterprise") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/enterprises/${args.enterprise}/code-security/configurations/defaults`, undefined, undefined); }, }, { name: "github_code_security_get_single_configuration_for_enterprise", description: "Retrieve a code security configuration of an enterprise", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), configuration_id: z.string().describe("configuration_id") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/enterprises/${args.enterprise}/code-security/configurations/${args.configuration_id}`, undefined, undefined); }, }, { name: "github_code_security_update_enterprise_configuration", description: "Update a custom code security configuration for an enterprise", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), configuration_id: z.string().describe("configuration_id"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("PATCH", `/enterprises/${args.enterprise}/code-security/configurations/${args.configuration_id}`, args.body, undefined); }, }, { name: "github_code_security_delete_configuration_for_enterprise", description: "Delete a code security configuration for an enterprise", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), configuration_id: z.string().describe("configuration_id") }), handler: async (args: Record<string, any>) => { return githubRequest("DELETE", `/enterprises/${args.enterprise}/code-security/configurations/${args.configuration_id}`, undefined, undefined); }, }, { name: "github_code_security_attach_enterprise_configuration", description: "Attach an enterprise configuration to repositories", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), configuration_id: z.string().describe("configuration_id"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("POST", `/enterprises/${args.enterprise}/code-security/configurations/${args.configuration_id}/attach`, args.body, undefined); }, }, { name: "github_code_security_set_configuration_as_default_for_enterprise", description: "Set a code security configuration as a default for an enterprise", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), configuration_id: z.string().describe("configuration_id"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("PUT", `/enterprises/${args.enterprise}/code-security/configurations/${args.configuration_id}/defaults`, args.body, undefined); }, }, { name: "github_code_security_get_repositories_for_enterprise_configuration", description: "Get repositories associated with an enterprise code security configuration", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), configuration_id: z.string().describe("configuration_id"), per_page: z.number().optional().describe("The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), before: z.string().optional().describe("A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), after: z.string().optional().describe("A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), status: z.string().optional().describe("A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. Can be: `all`, `attached`, `attaching`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise`") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/enterprises/${args.enterprise}/code-security/configurations/${args.configuration_id}/repositories`, undefined, { per_page: args.per_page, before: args.before, after: args.after, status: args.status }); }, }, { name: "github_code_security_get_configurations_for_org", description: "Get code security configurations for an organization", inputSchema: z.object({ org: z.string().describe("org"), target_type: z.enum(["global", "all"]).optional().describe("The target type of the code security configuration"), per_page: z.number().optional().describe("The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), before: z.string().optional().describe("A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), after: z.string().optional().describe("A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\"") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/orgs/${args.org}/code-security/configurations`, undefined, { target_type: args.target_type, per_page: args.per_page, before: args.before, after: args.after }); }, }, { name: "github_code_security_create_configuration", description: "Create a code security configuration", inputSchema: z.object({ org: z.string().describe("org"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("POST", `/orgs/${args.org}/code-security/configurations`, args.body, undefined); }, }, { name: "github_code_security_get_default_configurations", description: "Get default code security configurations", inputSchema: z.object({ org: z.string().describe("org") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/orgs/${args.org}/code-security/configurations/defaults`, undefined, undefined); }, }, { name: "github_code_security_detach_configuration", description: "Detach configurations from repositories", inputSchema: z.object({ org: z.string().describe("org") }), handler: async (args: Record<string, any>) => { return githubRequest("DELETE", `/orgs/${args.org}/code-security/configurations/detach`, undefined, undefined); }, }, { name: "github_code_security_get_configuration", description: "Get a code security configuration", inputSchema: z.object({ org: z.string().describe("org"), configuration_id: z.string().describe("configuration_id") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/orgs/${args.org}/code-security/configurations/${args.configuration_id}`, undefined, undefined); }, }, { name: "github_code_security_update_configuration", description: "Update a code security configuration", inputSchema: z.object({ org: z.string().describe("org"), configuration_id: z.string().describe("configuration_id"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("PATCH", `/orgs/${args.org}/code-security/configurations/${args.configuration_id}`, args.body, undefined); }, }, { name: "github_code_security_delete_configuration", description: "Delete a code security configuration", inputSchema: z.object({ org: z.string().describe("org"), configuration_id: z.string().describe("configuration_id") }), handler: async (args: Record<string, any>) => { return githubRequest("DELETE", `/orgs/${args.org}/code-security/configurations/${args.configuration_id}`, undefined, undefined); }, }, { name: "github_code_security_attach_configuration", description: "Attach a configuration to repositories", inputSchema: z.object({ org: z.string().describe("org"), configuration_id: z.string().describe("configuration_id"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("POST", `/orgs/${args.org}/code-security/configurations/${args.configuration_id}/attach`, args.body, undefined); }, }, { name: "github_code_security_set_configuration_as_default", description: "Set a code security configuration as a default for an organization", inputSchema: z.object({ org: z.string().describe("org"), configuration_id: z.string().describe("configuration_id"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("PUT", `/orgs/${args.org}/code-security/configurations/${args.configuration_id}/defaults`, args.body, undefined); }, }, { name: "github_code_security_get_repositories_for_configuration", description: "Get repositories associated with a code security configuration", inputSchema: z.object({ org: z.string().describe("org"), configuration_id: z.string().describe("configuration_id"), per_page: z.number().optional().describe("The number of results per page (max 100). For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), before: z.string().optional().describe("A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), after: z.string().optional().describe("A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see \"[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).\""), status: z.string().optional().describe("A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. Can be: `all`, `attached`, `attaching`, `detached`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise`") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/orgs/${args.org}/code-security/configurations/${args.configuration_id}/repositories`, undefined, { per_page: args.per_page, before: args.before, after: args.after, status: args.status }); }, }, { name: "github_code_security_get_configuration_for_repository", description: "Get the code security configuration associated with a repository", inputSchema: z.object({ owner: z.string().describe("owner"), repo: z.string().describe("repo") }), handler: async (args: Record<string, any>) => { return githubRequest("GET", `/repos/${args.owner}/${args.repo}/code-security-configuration`, undefined, undefined); }, }, ]; - src/tools/code-security.ts:20-28 (handler)The handler function for 'github_code_security_create_configuration_for_enterprise'. It makes a POST request to /enterprises/{enterprise}/code-security/configurations with the request body.
name: "github_code_security_create_configuration_for_enterprise", description: "Create a code security configuration for an enterprise", inputSchema: z.object({ enterprise: z.string().describe("enterprise"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), handler: async (args: Record<string, any>) => { return githubRequest("POST", `/enterprises/${args.enterprise}/code-security/configurations`, args.body, undefined); }, - src/tools/code-security.ts:22-25 (schema)Input schema for the tool: requires 'enterprise' (string) and optionally accepts 'body' (record/JSON object).
inputSchema: z.object({ enterprise: z.string().describe("enterprise"), body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)") }), - src/index.ts:106-130 (registration)Registration loop in src/index.ts where server.tool() is called for each tool object, registering the tool's name, description, inputSchema, and handler with the MCP server.
const allTools = allToolModules .filter((m) => !enabledCategories || enabledCategories.has(m.category)) .flatMap((m) => m.tools); for (const tool of allTools) { server.tool( tool.name, tool.description, tool.inputSchema.shape as any, async (args: any) => { try { const result = await tool.handler(args as any); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } } ); }