Skip to main content
Glama

githubSearchCode

Read-onlyIdempotent

Locate code patterns and file names across GitHub repositories using keyword, path, extension, and filename filters.

Instructions

Search GitHub code [EXTERNAL: GitHub API]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queriesYesResearch queries for githubSearchCode (1-3 queries per call for optimal resource management). Review schema before use for optimal results
responseCharOffsetNoCharacter offset for top-level bulk response pagination across results[]. Use when a multi-query response was auto-paginated.
responseCharLengthNoCharacter budget for top-level bulk response pagination across results[]. Overrides the shared default for this call.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultsYesArray of results, one per input query, discriminated by status
responsePaginationNoPagination metadata for top-level bulk response pagination across results[]

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed20 schema fields changedv9.1.1
    • removedInput schema / properties / queries / items / additionalProperties
      Removed value: -false
    • addedInput schema / properties / queries / items / properties / charLength
      Added value: +{
      +  "description": "Character budget for output pagination after domain pagination has been applied.",
      +  "maximum": 50000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / queries / items / properties / charOffset
      Added value: +{
      +  "description": "Character offset for output pagination after domain pagination has been applied.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / queries / items / properties / extension / description
      Added value: +"Extension without dot (ts, js, py)"
    • addedInput schema / properties / queries / items / properties / filename / description
      Added value: +"Filename pattern (case-insensitive)"
    • addedInput schema / properties / queries / items / properties / id
      Added value: +{
      +  "description": "Stable query identifier used to match each result to its input query. Required for every query. Use a short meaningful string like \"react_hooks_search\" or \"router_prs\".",
      +  "maxLength": 120,
      +  "minLength": 1,
      +  "pattern": "^[A-Za-z0-9._:-]+$",
      +  "type": "string"
      +}
    • addedInput schema / properties / queries / items / properties / keywordsToSearch / description
      Added value: +"Search terms (1-5, AND logic). match=file returns text_matches[]"
    • addedInput schema / properties / queries / items / properties / limit / description
      Added value: +"Max results (1-100). Default: 10"
    • addedInput schema / properties / queries / items / properties / mainResearchGoal / description
      Added value: +"Main research objective (multiple queries can share the same main goal for semantic grouping and session tracking)"
    • addedInput schema / properties / queries / items / properties / match / description
      Added value: +"\"file\" (content) | \"path\" (names). Omit for both"
    • addedInput schema / properties / queries / items / properties / owner / description
      Added value: +"Repo owner (omit for cross-repo)"
    • addedInput schema / properties / queries / items / properties / page / description
      Added value: +"Page (1-10). Default: 1"
    • addedInput schema / properties / queries / items / properties / path / description
      Added value: +"Directory path (strict prefix match)"
    • addedInput schema / properties / queries / items / properties / reasoning / description
      Added value: +"Why this query helps achieve the goal"
    • addedInput schema / properties / queries / items / properties / repo / description
      Added value: +"Repo name (use with owner)"
    • addedInput schema / properties / queries / items / properties / researchGoal / description
      Added value: +"Specific information this query seeks"
    • changedInput schema / properties / queries / items / required
      Previous value: -[
      -  "mainResearchGoal",
      -  "researchGoal",
      -  "reasoning",
      -  "keywordsToSearch"
      -]New value: +[
      +  "id",
      +  "mainResearchGoal",
      +  "researchGoal",
      +  "reasoning",
      +  "keywordsToSearch"
      +]
    • addedInput schema / properties / responseCharLength
      Added value: +{
      +  "description": "Character budget for top-level bulk response pagination across results[]. Overrides the shared default for this call.",
      +  "maximum": 50000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / responseCharOffset
      Added value: +{
      +  "description": "Character offset for top-level bulk response pagination across results[]. Use when a multi-query response was auto-paginated.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "responsePagination": {
      +      "additionalProperties": false,
      +      "description": "Pagination metadata for top-level bulk response pagination across results[]",
      +      "properties": {
      +        "charLength": {
      +          "description": "Character length of the current page",
      +          "maximum": 9007199254740991,
      +          "minimum": 0,
      +          "type": "integer"
      +        },
      +        "charOffset": {
      +          "description": "Character offset of the current page",
      +          "maximum": 9007199254740991,
      +          "minimum": 0,
      +          "type": "integer"
      +        },
      +        "currentPage": {
      +          "description": "Current page number (1-indexed)",
      +          "exclusiveMinimum": 0,
      +          "maximum": 9007199254740991,
      +          "type": "integer"
      +        },
      +        "hasMore": {
      +          "description": "Whether more pages are available after the current page",
      +          "type": "boolean"
      +        },
      +        "totalChars": {
      +          "description": "Total number of characters in the full output",
      +          "maximum": 9007199254740991,
      +          "minimum": 0,
      +          "type": "integer"
      +        },
      +        "totalPages": {
      +          "description": "Total number of pages available",
      +          "exclusiveMinimum": 0,
      +          "maximum": 9007199254740991,
      +          "type": "integer"
      +        }
      +      },
      +      "required": [
      +        "currentPage",
      +        "totalPages",
      +        "hasMore",
      +        "charOffset",
      +        "charLength",
      +        "totalChars"
      +      ],
      +      "type": "object"
      +    },
      +    "results": {
      +      "description": "Array of results, one per input query, discriminated by status",
      +      "items": {
      +        "anyOf": [
      +          {
      +            "additionalProperties": false,
      +            "properties": {
      +              "data": {
      +                "additionalProperties": false,
      +                "description": "The tool-specific result data",
      +                "properties": {
      +                  "files": {
      +                    "description": "Matching files with repository context and snippets",
      +                    "items": {
      +                      "additionalProperties": false,
      +                      "properties": {
      +                        "lastModifiedAt": {
      +                          "description": "Last modified timestamp for the file",
      +                          "type": "string"
      +                        },
      +                        "owner": {
      +                          "description": "Repository owner",
      +                          "type": "string"
      +                        },
      +                        "path": {
      +                          "description": "Path of the matching file in the repository",
      +                          "type": "string"
      +                        },
      +                        "repo": {
      +                          "description": "Repository name",
      +                          "type": "string"
      +                        },
      +                        "text_matches": {
      +                          "description": "Matched code snippets when searching file content",
      +                          "items": {
      +                            "anyOf": [
      +                              {
      +                                "type": "string"
      +                              },
      +                              {
      +                                "additionalProperties": false,
      +                                "properties": {
      +                                  "matchIndices": {
      +                                    "description": "Character offset positions of matches within the snippet",
      +                                    "items": {
      +                                      "additionalProperties": false,
      +                                      "properties": {
      +                                        "end": {
      +                                          "description": "End offset of match",
      +                                          "maximum": 9007199254740991,
      +                                          "minimum": 0,
      +                                          "type": "integer"
      +                                        },
      +                                        "start": {
      +                                          "description": "Start offset of match",
      +                                          "maximum": 9007199254740991,
      +                                          "minimum": 0,
      +                                          "type": "integer"
      +                                        }
      +                                      },
      +                                      "required": [
      +                                        "start",
      +                                        "end"
      +                                      ],
      +                                      "type": "object"
      +                                    },
      +                                    "type": "array"
      +                                  },
      +                                  "value": {
      +                                    "description": "Matched code snippet context",
      +                                    "type": "string"
      +                                  }
      +                                },
      +                                "required": [
      +                                  "value"
      +                                ],
      +                                "type": "object"
      +                              }
      +                            ]
      +                          },
      +                          "type": "array"
      +                        }
      +                      },
      +                      "required": [
      +                        "path"
      +                      ],
      +                      "type": "object"
      +                    },
      +                    "type": "array"
      +                  },
      +                  "hints": {
      +                    "description": "Contextual hints and suggestions for next steps or better queries",
      +                    "items": {
      +                      "type": "string"
      +                    },
      +                    "type": "array"
      +                  },
      +                  "outputPagination": {
      +                    "additionalProperties": false,
      +                    "description": "Payload pagination metadata when the result body was size-paginated",
      +                    "properties": {
      +                      "charLength": {
      +                        "description": "Character length of the current page",
      +                        "maximum": 9007199254740991,
      +                        "minimum": 0,
      +                        "type": "integer"
      +                      },
      +                      "charOffset": {
      +                        "description": "Character offset of the current page",
      +                        "maximum": 9007199254740991,
      +                        "minimum": 0,
      +                        "type": "integer"
      +                      },
      +                      "currentPage": {
      +                        "description": "Current page number (1-indexed)",
      +                        "exclusiveMinimum": 0,
      +                        "maximum": 9007199254740991,
      +                        "type": "integer"
      +                      },
      +                      "hasMore": {
      +                        "description": "Whether more pages are available after the current page",
      +                        "type": "boolean"
      +                      },
      +                      "totalChars": {
      +                        "description": "Total number of characters in the full output",
      +                        "maximum": 9007199254740991,
      +                        "minimum": 0,
      +                        "type": "integer"
      +                      },
      +                      "totalPages": {
      +                        "description": "Total number of pages available",
      +                        "exclusiveMinimum": 0,
      +                        "maximum": 9007199254740991,
      +                        "type": "integer"
      +                      }
      +                    },
      +                    "required": [
      +                      "currentPage",
      +                      "totalPages",
      +                      "hasMore",
      +                      "charOffset",
      +                      "charLength",
      +                      "totalChars"
      +                    ],
      +                    "type": "object"
      +                  },
      +                  "pagination": {
      +                    "additionalProperties": false,
      +                    "description": "Pagination info for navigating through search results",
      +                    "properties": {
      +                      "currentPage": {
      +                        "description": "Current page number (1-indexed)",
      +                        "exclusiveMinimum": 0,
      +                        "maximum": 9007199254740991,
      +                        "type": "integer"
      +                      },
      +                      "hasMore": {
      +                        "description": "Whether more pages are available after the current page",
      +                        "type": "boolean"
      +                      },
      +                      "perPage": {
      +                        "description": "Results returned per page",
      +                        "exclusiveMinimum": 0,
      +                        "maximum": 9007199254740991,
      +                        "type": "integer"
      +                      },
      +                      "totalMatches": {
      +                        "description": "Total matching results across all pages",
      +                        "maximum": 9007199254740991,
      +                        "minimum": 0,
      +                        "type": "integer"
      +                      },
      +                      "totalPages": {
      +                        "description": "Total number of pages available",
      +                        "exclusiveMinimum": 0,
      +                        "maximum": 9007199254740991,
      +                        "type": "integer"
      +                      }
      +                    },
      +                    "required": [
      +                      "currentPage",
      +                      "totalPages",
      +                      "hasMore",
      +                      "perPage",
      +                      "totalMatches"
      +                    ],
      +                    "type": "object"
      +                  },
      +                  "repositoryContext": {
      +                    "additionalProperties": false,
      +                    "description": "Repository context metadata for single-repository searches",
      +                    "properties": {
      +                      "branch": {
      +                        "description": "Default branch of the repository",
      +                        "type": "string"
      +                      }
      +                    },
      +                    "required": [
      +                      "branch"
      +                    ],
      +                    "type": "object"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "id": {
      +                "description": "Stable query identifier matching the input query id",
      +                "minLength": 1,
      +                "type": "string"
      +              },
      +              "status": {
      +                "const": "hasResults",
      +                "description": "Indicates the query returned results successfully",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "status",
      +              "data"
      +            ],
      +            "type": "object"
      +          },
      +          {
      +            "additionalProperties": false,
      +            "properties": {
      +              "data": {
      +                "additionalProperties": {},
      +                "description": "Empty result metadata (may contain hints or paging details)",
      +                "properties": {},
      +                "type": "object"
      +              },
      +              "id": {
      +                "description": "Stable query identifier matching the input query id",
      +                "minLength": 1,
      +                "type": "string"
      +              },
      +              "status": {
      +                "const": "empty",
      +                "description": "Indicates the query returned no matching results",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "status",
      +              "data"
      +            ],
      +            "type": "object"
      +          },
      +          {
      +            "additionalProperties": false,
      +            "properties": {
      +              "data": {
      +                "additionalProperties": false,
      +                "description": "Error details including message, type, and recovery hints",
      +                "properties": {
      +                  "cwd": {
      +                    "description": "Working directory relevant to the error",
      +                    "type": "string"
      +                  },
      +                  "error": {
      +                    "anyOf": [
      +                      {
      +                        "type": "string"
      +                      },
      +                      {
      +                        "additionalProperties": false,
      +                        "properties": {
      +                          "error": {
      +                            "description": "GitHub API error message",
      +                            "type": "string"
      +                          },
      +                          "hints": {
      +                            "description": "Provider-specific hints",
      +                            "items": {
      +                              "type": "string"
      +                            },
      +                            "type": "array"
      +                          },
      +                          "rateLimitRemaining": {
      +                            "description": "Remaining API requests in the current rate limit window",
      +                            "type": "number"
      +                          },
      +                          "rateLimitReset": {
      +                            "description": "Rate limit reset time in milliseconds since epoch",
      +                            "type": "number"
      +                          },
      +                          "retryAfter": {
      +                            "description": "Retry-after delay in seconds",
      +                            "type": "number"
      +                          },
      +                          "scopesSuggestion": {
      +                            "description": "Suggested scopes needed to resolve the error",
      +                            "type": "string"
      +                          },
      +                          "status": {
      +                            "description": "HTTP status code",
      +                            "maximum": 9007199254740991,
      +                            "minimum": -9007199254740991,
      +                            "type": "integer"
      +                          },
      +                          "type": {
      +                            "description": "GitHub API error category",
      +                            "enum": [
      +                              "http",
      +                              "graphql",
      +                              "network",
      +                              "unknown"
      +                            ],
      +                            "type": "string"
      +                          }
      +                        },
      +                        "required": [
      +                          "error",
      +                          "type"
      +                        ],
      +                        "type": "object"
      +                      }
      +                    ],
      +                    "description": "Error message or API error object"
      +                  },
      +                  "errorCode": {
      +                    "description": "Tool error code",
      +                    "type": "string"
      +                  },
      +                  "errorType": {
      +                    "description": "Tool-specific error type (e.g. symbol_not_found, size_limit)",
      +                    "type": "string"
      +                  },
      +                  "hints": {
      +                    "description": "Recovery hints",
      +                    "items": {
      +                      "type": "string"
      +                    },
      +                    "type": "array"
      +                  },
      +                  "resolvedPath": {
      +                    "description": "Resolved filesystem path involved in the error",
      +                    "type": "string"
      +                  },
      +                  "searchRadius": {
      +                    "description": "LSP search radius when symbol not found",
      +                    "type": "number"
      +                  }
      +                },
      +                "required": [
      +                  "error"
      +                ],
      +                "type": "object"
      +              },
      +              "id": {
      +                "description": "Stable query identifier matching the input query id",
      +                "minLength": 1,
      +                "type": "string"
      +              },
      +              "status": {
      +                "const": "error",
      +                "description": "Indicates the query encountered an error",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "status",
      +              "data"
      +            ],
      +            "type": "object"
      +          }
      +        ]
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "results"
      +  ],
      +  "type": "object"
      +}
  2. Changed27 schema fields changedv1.0.0
    • changedInput schema / properties / queries / description
      Previous value: -"Array of up to 5 different search queries for parallel execution"New value: +"Research queries for githubSearchCode (1-3 queries per call for optimal resource management). Review schema before use for optimal results"
    • removedInput schema / properties / queries / items / properties / extension / description
      Removed value: -"File extension filter"
    • removedInput schema / properties / queries / items / properties / filename / description
      Removed value: -"Target specific filename or pattern"
    • removedInput schema / properties / queries / items / properties / id
      Removed value: -{
      -  "description": "Optional identifier for the query",
      -  "type": "string"
      -}
    • addedInput schema / properties / queries / items / properties / keywordsToSearch
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "maxItems": 5,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • removedInput schema / properties / queries / items / properties / language
      Removed value: -{
      -  "description": "Programming language filter",
      -  "type": "string"
      -}
    • addedInput schema / properties / queries / items / properties / limit / default
      Added value: +10
    • removedInput schema / properties / queries / items / properties / limit / description
      Removed value: -"Maximum results per query (1-100)"
    • addedInput schema / properties / queries / items / properties / mainResearchGoal
      Added value: +{
      +  "type": "string"
      +}
    • removedInput schema / properties / queries / items / properties / match / description
      Removed value: -"Search scope: file (content) or path (filenames)"
    • removedInput schema / properties / queries / items / properties / minify
      Removed value: -{
      -  "default": true,
      -  "description": "Optimize content for token efficiency (enabled by default). Removes excessive whitespace and comments. Set to false only when exact formatting is required.",
      -  "type": "boolean"
      -}
    • removedInput schema / properties / queries / items / properties / owner / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  }
      -]
    • removedInput schema / properties / queries / items / properties / owner / description
      Removed value: -"Repository owner/organization name"
    • addedInput schema / properties / queries / items / properties / owner / type
      Added value: +"string"
    • addedInput schema / properties / queries / items / properties / page
      Added value: +{
      +  "default": 1,
      +  "maximum": 10,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / queries / items / properties / path
      Added value: +{
      +  "type": "string"
      +}
    • removedInput schema / properties / queries / items / properties / queryTerms
      Removed value: -{
      -  "description": "Search terms with AND logic - ALL terms must be present in same file. Use sparingly: single terms get broader results, multiple terms are restrictive.",
      -  "items": {
      -    "type": "string"
      -  },
      -  "type": "array"
      -}
    • addedInput schema / properties / queries / items / properties / reasoning
      Added value: +{
      +  "type": "string"
      +}
    • removedInput schema / properties / queries / items / properties / repo / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  }
      -]
    • removedInput schema / properties / queries / items / properties / repo / description
      Removed value: -"Repository name (use with owner for specific repo)"
    • addedInput schema / properties / queries / items / properties / repo / type
      Added value: +"string"
    • addedInput schema / properties / queries / items / properties / researchGoal
      Added value: +{
      +  "type": "string"
      +}
    • removedInput schema / properties / queries / items / properties / sanitize
      Removed value: -{
      -  "default": true,
      -  "description": "Sanitize content for security (enabled by default). Removes potential secrets and malicious content. Set to false only when raw content is required.",
      -  "type": "boolean"
      -}
    • removedInput schema / properties / queries / items / properties / size
      Removed value: -{
      -  "description": "File size filter in KB",
      -  "pattern": "^(>=?\\d+|<=?\\d+|\\d+\\.\\.\\d+|\\d+)$",
      -  "type": "string"
      -}
    • removedInput schema / properties / queries / items / properties / visibility
      Removed value: -{
      -  "description": "Repository visibility",
      -  "enum": [
      -    "public",
      -    "private",
      -    "internal"
      -  ],
      -  "type": "string"
      -}
    • addedInput schema / properties / queries / items / required
      Added value: +[
      +  "mainResearchGoal",
      +  "researchGoal",
      +  "reasoning",
      +  "keywordsToSearch"
      +]
    • changedInput schema / properties / queries / maxItems
      Previous value: -5New value: +3
  3. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=true. The description adds substantial behavioral detail beyond annotations, including strict prefix matching for 'path', pagination parameters, match type behavior, and filtering constraints.

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 long but well-structured with clear sections (<when>, <fromTool>, <toTool>, <gotchas>, <examples>). It is front-loaded with essential usage context, though some redundancy exists (e.g., repeating 'match' behavior in multiple places).

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

Completeness5/5

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

Given the tool's complexity with nested queries and multiple parameters, the description is remarkably complete. It covers when to use, how to chain with other tools, gotchas, and examples. The presence of an output schema reduces the need to explain return values.

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

Parameters5/5

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

Input schema covers all parameters with descriptions, and schema coverage is 100%. The description enriches parameter understanding with contextual advice like 'Start lean: single filter -> verify -> add filters' and explicit examples, adding meaning beyond 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?

The description clearly states that the tool searches GitHub code, with explicit directives to 'Find code patterns' and 'Locate files by path'. It distinguishes between match=file and match=path, and mentions cross-repo usage. Sibling tools like githubSearchRepositories and githubGetFileContent are differentiated through usage guidance.

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

Usage Guidelines5/5

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

The <when> section defines appropriate contexts, and <fromTool> and <toTool> sections provide explicit sequencing with sibling tools. The <gotchas> section offers critical do's and don'ts, such as avoiding combining extension+filename+path and preferring owner+repo for precision.

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

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/bgauryy/octocode'

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