Skip to main content
Glama
dalebrubaker

sourcegraph-mcp

by dalebrubaker

search_sourcegraph_regex

Search code using regular expressions with automatic regexp pattern type. Apply filters to narrow results by repository or language for precise code search.

Instructions

Search code using regular expressions. Automatically sets patternType to 'regexp' for regex queries. Use this for complex pattern matching.

Examples:

  • 'class \w+Service' - Find all service classes

  • 'def (get|set)_\w+' - Find getter/setter methods

  • 'TODO|FIXME|HACK' - Find code comments

  • 'function \w+(.*) {' - Find function declarations

Tips:

  • Use filters parameter for additional constraints

  • Combine with repo:, file:, and lang: filters

  • Remember to escape backslashes in regex patterns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesRegular expression pattern to search for
filtersNoAdditional filters (e.g., 'repo:owner/name lang:python')
max_resultsNoMaximum number of results (default: 10)
Behavior3/5

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

The description discloses that it automatically sets patternType to 'regexp' and reminds users to escape backslashes. However, with no annotations provided, it does not cover potential performance issues, limitations, or authentication requirements.

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 with clear sections (examples, tips). It uses bullet points for readability. Could be slightly shorter without losing key information.

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?

The description lacks explanation of the return format (no output schema) and does not mention authentication or API context. However, it provides useful examples and tips.

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?

Schema coverage is 100%, so the schema already documents parameters. The description adds examples and tips for the pattern parameter and mentions filters, but this is not substantial 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 code using regular expressions for complex pattern matching. It distinguishes itself from siblings like search_sourcegraph (likely literal) and find_symbol_*, making its purpose specific and unambiguous.

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

Usage Guidelines4/5

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

The description advises 'Use this for complex pattern matching' and provides examples and tips on combining with filters. It implicitly suggests alternatives but does not explicitly state when not to use it or exclude literal searches.

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

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/dalebrubaker/sourcegraph-mcp'

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