Skip to main content
Glama
get_file_content.js1.31 kB
/** * Get content of a specific file from a GitHub repository */ export const getFileContentToolDefinition = { name: 'get_file_content', description: 'Get content of a specific file from a GitHub repository', inputSchema: { type: 'object', properties: { owner: { type: 'string', description: 'Repository owner', }, repo: { type: 'string', description: 'Repository name', }, path: { type: 'string', description: 'File path in the repository', }, ref: { type: 'string', description: 'Git reference (branch, tag, or commit SHA)', default: 'main', }, }, required: ['owner', 'repo', 'path'], }, }; export async function handleGetFileContent(github, args) { const { owner, repo, path, ref = 'main' } = args; if (!owner || !repo || !path) { throw new Error('Owner, repo, and path are required'); } const content = await github.getFileContent(owner, repo, path, ref); return { content: [ { type: 'text', text: JSON.stringify( { owner, repo, path, ref, content: content || null, }, null, 2 ), }, ], }; }

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

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