search_workspace
Search across projects, initiatives, tasks, documents, and milestones with initiative awareness to find relevant workspace entities using queries and filters.
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 core handler function for the 'search_workspace' MCP tool. It validates input using Zod schema, logs the search parameters, delegates to supabaseService.searchWorkspace API call, and returns the 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 object definition that registers the 'search_workspace' tool, including name, description, and JSON input schema.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:630-642 (registration)Object exporting all initiative-related handlers, including 'search_workspace', likely used for tool registration in the MCP server.export const initiativeHandlers = { list_initiatives: listInitiatives, get_initiative: getInitiative, create_initiative: createInitiative, update_initiative: updateInitiative, get_initiative_context: getInitiativeContext, get_initiative_insights: getInitiativeInsights, search_workspace: searchWorkspace, get_enhanced_project_context: getEnhancedProjectContext, get_workspace_context: getWorkspaceContext, associate_document_with_initiative: associateDocumentWithInitiative, disassociate_document_from_initiative: disassociateDocumentFromInitiative }
- src/lib/api-client.ts:585-591 (helper)API client helper method called by the tool handler to perform the actual search by POSTing to the server /api/mcp/search endpoint.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 }