Skip to main content
Glama

create_or_update_file

在 GitHub 仓库中创建或修改一个文本文件(一次提交)。自动识别创建/更新(更新已有文件时自动带 sha)。适合让 AI 代理代用户提交配置、文档、小段代码改动。认证:优先由客户端在 MCP 请求头携带 Authorization: Bearer (需 repo scope 且对该仓库有写权限,token 不进入对话上下文);未配置请求头时兼容 user_token 参数。本服务仅转发不存储。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "owner": "<owner>",
      "repo": "<repo>",
      "path": "<path>",
      "content": "<content>",
      "message": "<message>"
    },
    "name": "create_or_update_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes文件仓库内相对路径,如 docs/notes.md 或 package.json
repoYes仓库名
ownerYes仓库属主
branchNo目标分支,缺省用默认分支
contentYes文件完整文本内容(UTF-8,全量覆盖)
messageYes提交说明
user_tokenNo可选(兼容旧用法):GitHub PAT。推荐改用客户端 headers 配置 Authorization: Bearer,模型无需接触 token

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / user_token / description
      Previous value: -"调用者自己的 GitHub PAT(需 repo scope 且对该仓库有写权限)"New value: +"可选(兼容旧用法):GitHub PAT。推荐改用客户端 headers 配置 Authorization: Bearer,模型无需接触 token"
    • changedInput schema / required
      Previous value: -[
      -  "owner",
      -  "repo",
      -  "path",
      -  "content",
      -  "message",
      -  "user_token"
      -]New value: +[
      +  "owner",
      +  "repo",
      +  "path",
      +  "content",
      +  "message"
      +]
  2. Added

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses auto-sha handling for updates, required PAT scope and write permission, preferred header-based auth (token kept out of the conversation context) with a user_token fallback, and that the service only forwards and stores nothing. It still omits what happens on concurrent-edit conflicts and what the call returns (no output schema exists), leaving those behaviors opaque.

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?

Front-loaded with the purpose in the first sentence, then behavior, then auth details; each sentence contributes something concrete. It is slightly dense with auth caveats, but no sentence is redundant filler.

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

Completeness4/5

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

For a 7-parameter mutation tool with no annotations and no output schema, the description covers the critical unknowns: auth model, token handling, create-vs-update behavior, and statelessness. The notable gap is the absence of any statement about the return payload or error/conflict behavior, which matters given there is no output schema.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description goes beyond by explaining the auto-sha mechanism, which justifies why no sha parameter exists and how updates are detected, and by clarifying the auth precedence behind user_token. The remaining parameters (owner/repo/path/content/message) are covered only by the schema.

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

Purpose5/5

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

States a specific verb+resource+scope: create or modify a single text file in a GitHub repo as one commit, and additionally explains the create-vs-update auto-detection (auto sha on existing files). This clearly separates it from siblings like read_file, list_files, and create_bundle_link without needing to open any schema.

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

Usage Guidelines4/5

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

Explicitly frames the intended use case: letting an AI agent commit config, docs, or small code changes on the user's behalf. It does not state exclusions (e.g., binary files, large files, or when to prefer another write path), so it stops short of full when/when-not guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources