github_codes_of_conduct_get_all_codes_of_conduct
Retrieve all codes of conduct from GitHub to understand and comply with community standards.
Instructions
Get all codes of conduct
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/codes-of-conduct.ts:11-12 (handler)The handler function for the tool. Makes a GET request to /codes_of_conduct to retrieve all codes of conduct.
return githubRequest("GET", `/codes_of_conduct`, undefined, undefined); }, - src/tools/codes-of-conduct.ts:9-9 (schema)Input schema for the tool (empty object, no parameters required).
inputSchema: z.object({}), - src/tools/codes-of-conduct.ts:7-7 (registration)Tool definition/registration with name and description.
name: "github_codes_of_conduct_get_all_codes_of_conduct", - src/index.ts:110-112 (registration)MCP server registration: the tool is registered on the server via server.tool() which binds the name, description, schema, and handler.
for (const tool of allTools) { server.tool( tool.name, - src/client.ts:9-59 (helper)The githubRequest helper function that performs the actual HTTP request to the GitHub API.
export async function githubRequest<T>( method: string, path: string, body?: Record<string, unknown>, params?: Record<string, string | number | boolean | string[] | undefined> ): Promise<T> { const url = new URL(`${BASE_URL}${path}`); if (params) { for (const [key, value] of Object.entries(params)) { if (value === undefined || value === null || value === "") continue; if (Array.isArray(value)) { url.searchParams.set(key, value.join(",")); } else { url.searchParams.set(key, String(value)); } } } const headers: Record<string, string> = { Authorization: `Bearer ${getToken()}`, Accept: "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28", "User-Agent": "github-mcp/1.0.0", }; if (body) { headers["Content-Type"] = "application/json"; } const res = await fetch(url.toString(), { method, headers, body: body ? JSON.stringify(body) : undefined, }); if (!res.ok) { const text = await res.text().catch(() => ""); let detail = text; try { const json = JSON.parse(text); detail = json.message || text; if (json.errors) detail += ` -- ${JSON.stringify(json.errors)}`; } catch {} throw new Error(`GitHub API error ${res.status}: ${detail}`); } if (res.status === 204) return {} as T; return res.json() as Promise<T>; }