search_workspace
Search across projects, initiatives, tasks, documents, and milestones in your workspace to find relevant information quickly.
Instructions
Search across all entity types with initiative awareness
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The search query to use | |
| filters | No | ||
| limit | No |
Implementation Reference
- src/tools/initiatives.ts:466-474 (handler)The primary handler function for the 'search_workspace' MCP tool. It validates input using SearchWorkspaceSchema, logs the operation, delegates to supabaseService.searchWorkspace (API client), and returns the search results.export const searchWorkspace = requireAuth(async (args: any) => { const { query, filters, limit } = SearchWorkspaceSchema.parse(args) logger.info('Searching workspace', { query, filters, limit }) const results = await supabaseService.searchWorkspace(query, filters, limit) return results })
- src/tools/initiatives.ts:455-464 (schema)Zod schema used for input validation in the search_workspace handler.const SearchWorkspaceSchema = z.object({ query: z.string().min(2), filters: z.object({ type: z.enum(['project', 'initiative', 'task', 'document', 'milestone']).optional(), project_id: z.string().uuid().optional(), initiative_id: z.string().uuid().optional(), status: z.string().optional() }).optional(), limit: z.number().int().positive().max(100).default(20) })
- src/tools/initiatives.ts:413-453 (registration)MCPTool definition for 'search_workspace', including name, description, and input schema for registration.export const searchWorkspaceTool: MCPTool = { name: 'search_workspace', description: 'Search across all entity types with initiative awareness', inputSchema: { type: 'object', properties: { query: { type: 'string', minLength: 2, description: 'The search query to use' }, filters: { type: 'object', properties: { type: { type: 'string', enum: ['project', 'initiative', 'task', 'document', 'milestone'] }, project_id: { type: 'string', format: 'uuid' }, initiative_id: { type: 'string', format: 'uuid' }, status: { type: 'string' } } }, limit: { type: 'number', minimum: 1, maximum: 100, default: 20 } }, required: ['query'] } }
- src/tools/initiatives.ts:637-637 (registration)Registration of the search_workspace handler in the initiativeHandlers export object, mapping the tool name to its handler function.search_workspace: searchWorkspace,
- src/lib/api-client.ts:585-591 (helper)supabaseService.searchWorkspace method, which makes the actual API call to /api/mcp/search, used by the tool handler.async searchWorkspace(query: string, filters?: any, limit?: number): Promise<any> { const response = await this.request<any>('/api/mcp/search', { method: 'POST', body: JSON.stringify({ query, filters, limit }), }) return response }