boj_github_graphql
Execute GitHub GraphQL queries to retrieve repository data, user information, or manage GitHub resources through structured API calls.
Instructions
Execute a GitHub GraphQL query
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| variables | No |
Implementation Reference
- mcp-bridge/main.js:187-205 (handler)The actual implementation that executes the GitHub GraphQL request.
async function githubGraphQL(query, variables) { if (!GITHUB_TOKEN) { return { error: "GITHUB_TOKEN not set." }; } try { const res = await fetch("https://api.github.com/graphql", { method: "POST", headers: { "Authorization": `Bearer ${GITHUB_TOKEN}`, "Content-Type": "application/json", "User-Agent": "boj-server/0.3.0", }, body: JSON.stringify({ query, variables: variables || {} }), }); return await res.json(); } catch (err) { return { error: `GitHub GraphQL error: ${err.message}` }; } } - mcp-bridge/main.js:235-268 (handler)The dispatching logic that invokes the 'githubGraphQL' function when the 'boj_github_graphql' tool is called.
async function handleGitHubTool(toolName, args) { switch (toolName) { case "boj_github_list_repos": return githubApiCall("GET", `/user/repos?per_page=${args.per_page || 30}&sort=${args.sort || "updated"}`); case "boj_github_get_repo": return githubApiCall("GET", `/repos/${args.owner}/${args.repo}`); case "boj_github_create_issue": return githubApiCall("POST", `/repos/${args.owner}/${args.repo}/issues`, { title: args.title, body: args.body, labels: args.labels }); case "boj_github_list_issues": return githubApiCall("GET", `/repos/${args.owner}/${args.repo}/issues?state=${args.state || "open"}&per_page=${args.per_page || 30}`); case "boj_github_get_issue": return githubApiCall("GET", `/repos/${args.owner}/${args.repo}/issues/${args.issue_number}`); case "boj_github_comment_issue": return githubApiCall("POST", `/repos/${args.owner}/${args.repo}/issues/${args.issue_number}/comments`, { body: args.body }); case "boj_github_create_pr": return githubApiCall("POST", `/repos/${args.owner}/${args.repo}/pulls`, { title: args.title, body: args.body, head: args.head, base: args.base || "main" }); case "boj_github_list_prs": return githubApiCall("GET", `/repos/${args.owner}/${args.repo}/pulls?state=${args.state || "open"}`); case "boj_github_get_pr": return githubApiCall("GET", `/repos/${args.owner}/${args.repo}/pulls/${args.pull_number}`); case "boj_github_merge_pr": return githubApiCall("PUT", `/repos/${args.owner}/${args.repo}/pulls/${args.pull_number}/merge`, { merge_method: args.method || "merge" }); case "boj_github_search_code": return githubApiCall("GET", `/search/code?q=${encodeURIComponent(args.query)}`); case "boj_github_search_issues": return githubApiCall("GET", `/search/issues?q=${encodeURIComponent(args.query)}`); case "boj_github_get_file": return githubApiCall("GET", `/repos/${args.owner}/${args.repo}/contents/${args.path}?ref=${args.ref || "main"}`); case "boj_github_graphql": return githubGraphQL(args.query, args.variables); default: return { error: `Unknown GitHub tool: ${toolName}` }; } } - mcp-bridge/main.js:543-543 (schema)The schema definition for the 'boj_github_graphql' tool, used in the MCP tool discovery process.
{ name: "boj_github_graphql", desc: "Execute a GitHub GraphQL query", props: { query: { type: "string" }, variables: { type: "object" } }, req: ["query"] },