Skip to main content
Glama

github_get_file

Retrieve file contents from a GitHub repository by specifying owner, repo, path, and an optional branch, tag, or commit ref.

Instructions

读取仓库中的文件内容。

Args: owner: 仓库拥有者。 repo: 仓库名称。 path: 文件路径,例如 src/main.py。 ref: 分支、标签或 commit SHA;留空使用默认分支。

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>"
    },
    "name": "github_get_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
refNo
pathYes
repoYes
ownerYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations, the description carries the full disclosure burden. It implies a safe read, but says nothing about authentication/token requirements, private-vs-public repo behavior, rate limits, or what happens when the path does not exist (404/None). Only the ref parameter's fallback to the default branch is behaviorally disclosed.

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 purpose is front-loaded in a single sentence, followed by a compact per-argument list with no filler. Slightly redundant in restating argument names, but each restatement adds definition.

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

Completeness3/5

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

An output schema exists, so return values need not be explained, and all four parameters are covered. However, for a remote-API read with no annotations, missing auth requirements and failure behavior leave the agent without enough to predict outcomes on private repos or bad refs.

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 description coverage is 0% — the schema provides only titles — so the Args block is doing real work: it defines owner, repo, path with a concrete example (src/main.py), and explains ref as branch/tag/commit SHA with empty meaning the default branch. That is meaningful semantics beyond the schema, falling short of 5 only because there is no guidance on path encoding or ref formats.

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 opening line states a specific verb and resource: read file content from a repository. The four argument names (owner/repo/path/ref) make it unambiguous that this is a GitHub-repo file reader rather than a local read, which separates it from fs_read in practice, though it never explicitly names or contrasts the siblings.

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?

There is no when-to-use / when-not-to-use guidance and no mention of alternatives such as fs_read (local files) or github_search_code (locating files by content). The agent must infer the use case entirely from the one-line purpose.

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