Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

search_code

Search for code across all repositories in a Bitbucket Cloud workspace to find specific functions, variables, or patterns.

Instructions

Search for code across all repositories in a workspace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
search_queryYesSearch query string
pageNoPage number
pagelenNoResults per page

Implementation Reference

  • Handler for 'search_code' tool in ToolHandler.handleTool method, parses args and delegates to SearchAPI.searchCode
    case 'search_code': { const params = toolSchemas.search_code.parse(args); return this.search.searchCode(params); }
  • Core implementation of searchCode in SearchAPI class, makes API call to Bitbucket search endpoint
    async searchCode(params: SearchCodeParams): Promise<PaginatedResponse<BitbucketSearchResult>> { const { workspace, search_query, ...queryParams } = params; return this.client.get<PaginatedResponse<BitbucketSearchResult>>( `/workspaces/${workspace}/search/code`, { search_query, ...queryParams, } as Record<string, string | number | undefined> ); }
  • Zod schema definition for search_code tool input parameters
    search_code: z.object({ workspace: z.string().describe('The workspace slug'), search_query: z.string().describe('Search query string'), page: z.number().optional().describe('Page number'), pagelen: z.number().optional().describe('Results per page'), }),
  • Registration of 'search_code' tool in the toolDefinitions export array for MCP
    { name: 'search_code', description: 'Search for code across all repositories in a workspace.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, search_query: { type: 'string', description: 'Search query string' }, page: { type: 'number', description: 'Page number' }, pagelen: { type: 'number', description: 'Results per page' }, }, required: ['workspace', 'search_query'], }, },
  • TypeScript interface defining SearchCodeParams for type safety
    export interface SearchCodeParams { workspace: string; search_query: string; page?: number; pagelen?: number; }

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/Lexmata/bitbucket-mcp'

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