Skip to main content
Glama

GenAIScript

Official
by microsoft
MIT License
43
2,820
  • Linux
  • Apple
system.github_pulls.genai.mts4.48 kB
system({ title: "Tools to query GitHub pull requests.", }) export default async function (ctx: ChatGenerationContext) { const { $, defTool } = ctx const pr = await github.getPullRequest() if (pr) { $`- current pull request number: ${pr.number} - current pull request base ref: ${pr.base.ref}` } defTool( "github_pulls_list", "List all pull requests in a repository.", { type: "object", properties: { state: { type: "string", enum: ["open", "closed", "all"], description: "state of the pull request from 'open, 'closed', 'all'. Default is 'open'.", }, labels: { type: "string", description: "Comma-separated list of labels to filter by.", }, sort: { type: "string", enum: ["created", "updated", "comments"], description: "What to sort by", }, direction: { type: "string", enum: ["asc", "desc"], description: "Direction to sort", }, count: { type: "number", description: "Number of pull requests to list. Default is 20.", }, }, }, async (args) => { const { context, state, sort, direction, count } = args context.log(`github pull list`) const res = await github.listPullRequests({ state, sort, direction, count, }) return CSV.stringify( res.map(({ number, title, state, body, user, assignee }) => ({ number, title, state, user: user?.login || "", assignee: assignee?.login || "", })), { header: true } ) } ) defTool( "github_pulls_get", "Get a single pull request by number.", { type: "object", properties: { number: { type: "number", description: "The 'number' of the pull request (not the id)", }, }, required: ["number"], }, async (args) => { const { number: pull_number, context } = args context.log(`github pull get ${pull_number}`) const { number, title, body, state, html_url, reactions, user, assignee, } = await github.getPullRequest(pull_number) return YAML.stringify({ number, title, body, state, user: user?.login || "", assignee: assignee?.login || "", html_url, reactions, }) } ) defTool( "github_pulls_review_comments_list", "Get review comments for a pull request.", { type: "object", properties: { number: { type: "number", description: "The 'number' of the pull request (not the id)", }, count: { type: "number", description: "Number of runs to list. Default is 20.", }, }, required: ["number"], }, async (args) => { const { number: pull_number, context, count } = args context.log(`github pull comments list ${pull_number}`) const res = await github.listPullRequestReviewComments( pull_number, { count, } ) return CSV.stringify( res.map(({ id, user, body }) => ({ id, user: user?.login || "", body, })), { header: true } ) } ) }

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/microsoft/genaiscript'

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