Skip to main content
Glama

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
NameRequiredDescriptionDefault
queryYes
variablesNo

Implementation Reference

  • 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}` };
      }
    }
  • 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}` };
      }
    }
  • 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"] },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states 'Execute a GitHub GraphQL query,' which implies a write operation could be possible (e.g., mutations), but doesn't clarify authentication needs, rate limits, error handling, or what 'execute' entails (e.g., returns raw GraphQL response). This leaves significant behavioral gaps for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded and gets straight to the point, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, 0% schema coverage, no output schema, and 2 parameters (one nested), the description is incomplete. It doesn't cover authentication, error cases, return format, or how to structure queries/variables, leaving the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It mentions 'GitHub GraphQL query,' which hints at the 'query' parameter's purpose, but doesn't explain the 'variables' parameter or provide any syntax examples, required scopes, or format details. This adds minimal value beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Execute a GitHub GraphQL query' clearly states the action (execute) and target (GitHub GraphQL query), which is better than a tautology. However, it's somewhat vague about what specifically is executed (e.g., raw queries vs. predefined operations) and doesn't distinguish it from sibling tools like boj_github_get_repo or boj_github_list_issues, which might also use GraphQL internally.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling GitHub tools (e.g., boj_github_get_file, boj_github_list_issues), it's unclear whether this is for custom queries when those specific tools are insufficient, or if it's the primary interface. No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/hyperpolymath/boj-server'

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