Skip to main content
Glama

search_code

Read-onlyIdempotent

Search code snippets across CERN GitLab repositories globally or within a specific project, returning matching files with line-level context.

Instructions

Search for code snippets across CERN GitLab repositories. Can search globally across all public projects or within a specific project. Returns matching files with line-level context. Useful for finding usage examples of specific libraries, functions, or patterns.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "search_term": "<search_term>"
    },
    "name": "search_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
refNoOptional: Git branch or tag to search within
pageNoPage number to retrieve
scopeNo'blobs' searches file content (default), 'filenames' searches only file namesblobs
projectNoOptional: limit search to a specific project (ID or path). If omitted, searches across all public projects.
per_pageNoNumber of results to return
search_termYesThe code or text to search for

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed18 schema fields changedv0.3.0
    • addedInput schema / properties / page / default
      Added value: +1
    • changedInput schema / properties / page / description
      Previous value: -"Page number to retrieve (default: 1)"New value: +"Page number to retrieve"
    • addedInput schema / properties / page / title
      Added value: +"Page"
    • addedInput schema / properties / per_page / default
      Added value: +20
    • changedInput schema / properties / per_page / description
      Previous value: -"Number of results to return (default: 20, max: 100)"New value: +"Number of results to return"
    • addedInput schema / properties / per_page / title
      Added value: +"Per Page"
    • addedInput schema / properties / project / default
      Added value: +""
    • changedInput schema / properties / project / description
      Previous value: -"Optional: limit search to a specific project. Either a numeric ID or path (e.g. 'atlas/athena'). If omitted, searches across all public projects."New value: +"Optional: limit search to a specific project (ID or path). If omitted, searches across all public projects."
    • addedInput schema / properties / project / title
      Added value: +"Project"
    • addedInput schema / properties / ref / default
      Added value: +""
    • changedInput schema / properties / ref / description
      Previous value: -"Optional: Git branch or tag to search within. If omitted, uses the default_ref from configuration (or GitLab's default branch behavior if not configured)."New value: +"Optional: Git branch or tag to search within"
    • addedInput schema / properties / ref / title
      Added value: +"Ref"
    • addedInput schema / properties / scope / default
      Added value: +"blobs"
    • changedInput schema / properties / scope / description
      Previous value: -"Search scope: 'blobs' searches file content (default), 'filenames' searches only file names"New value: +"'blobs' searches file content (default), 'filenames' searches only file names"
    • addedInput schema / properties / scope / title
      Added value: +"Scope"
    • addedInput schema / properties / search_term / title
      Added value: +"Search Term"
    • addedInput schema / title
      Added value: +"search_code_fnArguments"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "title": "search_code_fnDictOutput",
      +  "type": "object"
      +}
  2. Changed1 schema field changedv0.2.0
    • changedInput schema / properties / ref / description
      Previous value: -"Optional: Git branch or tag to search within. If omitted, uses the default_ref from configuration (or searches all branches if not configured)."New value: +"Optional: Git branch or tag to search within. If omitted, uses the default_ref from configuration (or GitLab's default branch behavior if not configured)."
  3. First observedv0.1.6

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive and open-world behavior, so the safety profile is covered. The description adds only the result shape ('matching files with line-level context'), and says nothing about rate limits, result caps, or how open-world global search behaves when no project is given.

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?

Four short sentences, front-loaded with the core action and scope before the use-case hint. Minor redundancy in the final sentence, which partly restates that this is a search tool, but nothing wasteful enough to obscure the call.

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

Completeness4/5

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

With full schema coverage, rich annotations, and an output schema, the description needn't explain parameters or return values. It covers purpose, scope and typical use case adequately; only pagination/result-cap behavior is left entirely to the schema, which is acceptable here.

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 description coverage is 100%, so every parameter including ref, scope, page, per_page and project is already documented in the schema. The description only restates the project-vs-global distinction; it adds no syntax or format detail (e.g., project ID vs. path form) beyond what the schema provides, so baseline 3 applies.

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 names a specific verb and resource ('Search for code snippets across CERN GitLab repositories') and clarifies scope (global public projects vs. a single project). It implicitly separates itself from retrieval siblings like get_file_content, but never names an alternative tool explicitly.

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?

It gives clear usage context — 'Useful for finding usage examples of specific libraries, functions, or patterns' — and states the two search modes (global vs. project-scoped). It offers no explicit when-not guidance or named alternative (e.g., use get_file_content when you already know the file path).

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