Skip to main content
Glama

search_symbol

Find Python classes, functions, and variables across your project using semantic code analysis to improve navigation and editing accuracy.

Instructions

Search symbols (classes, functions, variables) across the project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `search_symbol` MCP tool handler searches for symbols in the workspace using the `TyLspClient`.
    @mcp.tool()
    async def search_symbol(query: str) -> str:
        """Search symbols (classes, functions, variables) across the project."""
        client = _get_client()
    
        try:
            symbols = await client.search_workspace_symbols(query)
    
            if not symbols:
                return _not_found(f"No symbols matching '{query}'")
    
            results = []
            for sym in symbols:
                uri = sym.get("location", {}).get("uri", "")
                path = _uri_to_path(uri)
                name = sym.get("name", "?")
                kind = SYMBOL_KINDS.get(sym.get("kind", 0), "Symbol")
                range_info = sym.get("location", {}).get("range", {}).get("start", {})
                line = range_info.get("line", 0) + 1
                col = range_info.get("character", 0) + 1
                container = sym.get("containerName", "")
                results.append({
                    "name": name,
                    "kind": kind,
                    "file": path.name,
                    "path": str(path),
                    "line": line,
                    "column": col,
                    "container": container or None
                })
    
            return _ok({"query": query, "count": len(results), "symbols": results})
    
        except Exception as e:
            return _error(str(e))
Behavior2/5

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

No annotations provided, so description carries full disclosure burden. While 'across the project' establishes scope, description omits critical behavioral details: matching logic (substring vs. exact vs. fuzzy), case sensitivity, and result ranking. Output schema exists but search semantics remain undefined.

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?

Single efficient sentence with action front-loaded. No redundant words. However, extreme brevity contributes to informational gaps given the tool's complexity and lack of structured metadata.

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

Completeness2/5

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

Inadequate for a code navigation tool with 0% parameter schema coverage and numerous siblings. Missing: search syntax rules, relationship to other navigation tools, and performance expectations (e.g., large project implications).

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

Parameters2/5

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

Schema coverage is 0% (query parameter undocumented). Description provides context that query searches symbols, but fails to describe expected format (identifier rules, wildcards, case sensitivity) or give examples, leaving the parameter semantics largely unspecified.

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?

Clear specific verb 'Search' with concrete resource examples (classes, functions, variables) and explicit scope 'across the project'. However, lacks explicit differentiation from siblings like list_file_symbols or get_definition.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives such as list_file_symbols (file-specific) or get_definition (precise lookup). No mention of prerequisites or search prerequisites.

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/qinsehm1128/mcp-ty'

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