Skip to main content
Glama
Hint-Services

MCP Private GitHub Search

getFileContents

Retrieve the contents of a specific file from an Obsidian vault stored in a private GitHub repository, enabling direct access to your knowledge base content through a provided file path.

Instructions

Retrieve the contents of a specific note, document, or file from your Obsidian vault stored in GitHub (johndoe-org/obsidian-vault). Perfect for accessing your knowledge base content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the file within the repository.

Implementation Reference

  • Registration of the 'getFileContents' tool using server.tool(), including schema, hints, and the full handler implementation.
    server.tool(
      "getFileContents",
      `Retrieve the contents of a specific note, document, or file from your Obsidian vault stored in GitHub (${this.config.owner}/${this.config.repo}). Perfect for accessing your knowledge base content.`,
      {
        filePath: z
          .string()
          .describe("Path to the file within the repository."),
      },
      {
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true,
      },
      async ({ filePath }) => {
        const fileContent = await this.handleRequest(async () => {
          return this.octokit.repos.getContent({
            owner: this.config.owner,
            repo: this.config.repo,
            path: filePath,
            // Request raw content to avoid base64 decoding complexities for now
            mediaType: {
              format: "raw",
            },
          });
        });
    
        // The raw format returns the content directly as a string
        if (typeof fileContent !== "string") {
          throw new Error(
            "Received unexpected content format from GitHub API."
          );
        }
    
        return {
          content: [{ type: "text" as const, text: fileContent }],
        };
      }
    );
  • The handler function that retrieves the raw file contents from the GitHub repository using the Octokit API and returns it as text content.
    async ({ filePath }) => {
      const fileContent = await this.handleRequest(async () => {
        return this.octokit.repos.getContent({
          owner: this.config.owner,
          repo: this.config.repo,
          path: filePath,
          // Request raw content to avoid base64 decoding complexities for now
          mediaType: {
            format: "raw",
          },
        });
      });
    
      // The raw format returns the content directly as a string
      if (typeof fileContent !== "string") {
        throw new Error(
          "Received unexpected content format from GitHub API."
        );
      }
    
      return {
        content: [{ type: "text" as const, text: fileContent }],
      };
    }
  • Zod schema defining the input parameter 'filePath' for the tool.
    {
      filePath: z
        .string()
        .describe("Path to the file within the repository."),
    },
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 of behavioral disclosure. It mentions retrieving contents but doesn't specify behavioral traits such as read-only nature (implied by 'retrieve'), error handling (e.g., what happens if the file doesn't exist), rate limits, or authentication needs. The description adds some context about the GitHub repository ('johndoe-org/obsidian-vault'), but overall, it lacks detailed behavioral information for a tool with no annotation coverage.

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 concise and front-loaded, with two sentences that directly state the purpose and context. The first sentence clearly defines the action and resource, while the second adds value by highlighting the use case ('Perfect for accessing your knowledge base content'). There's no unnecessary fluff, making it efficient, though it could be slightly more structured to differentiate from siblings.

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?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is somewhat complete but has gaps. It covers the basic purpose and context but lacks details on behavioral traits, usage guidelines, and output expectations. Without annotations or an output schema, the description should do more to compensate, but it remains minimal, making it adequate but not fully comprehensive.

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

Parameters3/5

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

The input schema has 100% description coverage, with the parameter 'filePath' documented as 'Path to the file within the repository.' The description doesn't add any parameter-specific details beyond what the schema provides, such as format examples or constraints. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 tool's purpose: 'Retrieve the contents of a specific note, document, or file from your Obsidian vault stored in GitHub.' It specifies the verb ('retrieve'), resource ('contents of a specific note, document, or file'), and context ('Obsidian vault stored in GitHub'). However, it doesn't explicitly differentiate from sibling tools like 'searchFiles' or 'getCommitHistory' beyond mentioning 'Perfect for accessing your knowledge base content,' which is somewhat generic.

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 minimal usage guidance. It implies use for accessing knowledge base content but doesn't specify when to choose this tool over alternatives like 'searchFiles' (which might list files) or 'getCommitHistory' (which tracks changes). No explicit when/when-not instructions or prerequisites are given, leaving the agent to infer usage based on the purpose alone.

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

Related 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/Hint-Services/mcp-private-github-search'

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