Skip to main content
Glama

search_todos

Filter and locate tasks by title, description, status, or priority to streamline task management and improve productivity on the Todo List MCP Server.

Instructions

Search todos by title or description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
priorityNoFilter by priority
searchTermYesSearch term for title or description
statusNoFilter by statusall

Implementation Reference

  • The main handler function for the 'search_todos' tool. Validates input using SearchTodosSchema, calls the todoService.searchTodos method with appropriate filters, and returns a formatted response with search results or error.
    async handleSearchTodos(request: CallToolRequest): Promise<CallToolResult> { try { const sanitizedArgs = sanitizeInput(request.params.arguments); const validatedRequest = validateData(SearchTodosSchema, sanitizedArgs); const filters: any = {}; if (validatedRequest.status !== undefined) { filters.status = validatedRequest.status; } if (validatedRequest.priority !== undefined) { filters.priority = validatedRequest.priority; } const todos = this.todoService.searchTodos(validatedRequest.searchTerm, filters); return { content: [ { type: "text", text: `🔍 Busca por "${validatedRequest.searchTerm}" retornou ${todos.length} resultado(s):\n\n${JSON.stringify(todos, null, 2)}`, }, ], }; } catch (error) { const errorResponse = createErrorResponse(error, "buscar todos"); return { content: [ { type: "text", text: `❌ ${errorResponse.error}\n${errorResponse.details || ""}`, }, ], }; } }
  • Zod schema for input validation of the search_todos tool, defining searchTerm (required), status (optional, default 'all'), and priority (optional).
    export const SearchTodosSchema = z.object({ searchTerm: NonEmptyStringSchema.min(1, 'Termo de busca é obrigatório'), status: z.enum(['all', 'completed', 'pending']).default('all'), priority: z.enum(['low', 'medium', 'high']).optional() })
  • MCP tool definition/registration for 'search_todos', including name, description, and JSON schema for input parameters.
    name: "search_todos", description: "Search todos by title or description", inputSchema: { type: "object", properties: { searchTerm: { type: "string", minLength: 1, description: "Search term for title or description", }, status: { type: "string", enum: ["all", "completed", "pending"], description: "Filter by status", default: "all", }, priority: { type: "string", enum: ["low", "medium", "high"], description: "Filter by priority", }, }, required: ["searchTerm"], }, },
  • Helper method in TodoService that performs the search by passing searchTerm and filters to getAllTodos, which applies filtering logic including text search in title and description.
    searchTodos(searchTerm: string, filters?: Omit<TodoFilters, 'searchTerm'>): Todo[] { return this.getAllTodos({ ...filters, searchTerm }); }

Other Tools

Related 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/glaucia86/todo-list-mcp-server'

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