Skip to main content
Glama

github_codespaces_create_or_update_repo_secret

Create or update a repository secret for GitHub Codespaces using owner, repo, and secret name.

Instructions

Create or update a repository secret

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesowner
repoYesrepo
secret_nameYessecret_name
bodyNoRequest body (JSON object)

Implementation Reference

  • The handler function for the tool. Sends a PUT request to the GitHub API to create or update a repository secret, using owner, repo, secret_name, and an optional request body.
    handler: async (args: Record<string, any>) => {
      return githubRequest("PUT", `/repos/${args.owner}/${args.repo}/codespaces/secrets/${args.secret_name}`, args.body, undefined);
    },
  • Zod input schema defining the required fields (owner, repo, secret_name) and optional body for the tool.
    inputSchema: z.object({
      owner: z.string().describe("owner"),
      repo: z.string().describe("repo"),
      secret_name: z.string().describe("secret_name"),
      body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON object)")
    }),
  • src/index.ts:67-67 (registration)
    The tool array (codespacesTools) is registered in the MCP server under the 'codespaces' category in src/index.ts.
    { category: "codespaces", tools: codespacesTools },
  • The githubRequest helper function used by the handler to make HTTP requests to the GitHub API with authentication, headers, and error handling.
    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>;
    }
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only states 'Create or update', which is generic. It does not mention authentication requirements, whether the secret is encrypted, what happens on update, or any side effects. This leaves the agent with minimal behavioral insight.

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

Conciseness4/5

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

The description is a single sentence with no unnecessary words. It is concise and front-loaded, though it could benefit from a bit more detail without sacrificing brevity.

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?

There is no output schema, and the description does not mention return values. The tool is a mutation (create/update) but lacks information on success indicators, error handling, or idempotency. Given the complexity of secret management, the description is insufficient for an agent to reliably invoke the tool.

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?

The input schema has 100% description coverage but each description is just the parameter name (e.g., 'owner' for owner). The body parameter is described only as 'Request body (JSON object)' with no structure. The description adds no additional meaning beyond the schema, failing to clarify the expected body format or constraints.

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

Purpose4/5

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

The description clearly states the verb 'Create or update' and the resource 'repository secret'. However, it does not distinguish from sibling tools like github_actions_create_or_update_repo_secret, which has an identical description. The name implies it's for Codespaces, but the description does not clarify this scope.

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?

No guidance is provided on when to use this tool versus alternatives (e.g., github_actions_create_or_update_repo_secret or github_codespaces_create_or_update_org_secret). There is no mention of prerequisites, context, or when not to use it.

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/Eyalm321/github-mcp'

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