Skip to main content
Glama

search_todos

Find tasks in your todo list by searching titles or descriptions, with options to filter by status and priority.

Instructions

Search todos by title or description

Input Schema

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

Implementation Reference

  • Main handler function for 'search_todos' tool: validates input with SearchTodosSchema, constructs filters, calls todoService.searchTodos, and returns formatted 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 defining input validation for search_todos tool: requires searchTerm, optional status and priority filters.
    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 registration definition including name, description, and input schema for 'search_todos'.
    { 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 service method implementing the search logic by delegating to getAllTodos with searchTerm and filters.
    searchTodos(searchTerm: string, filters?: Omit<TodoFilters, 'searchTerm'>): Todo[] { return this.getAllTodos({ ...filters, searchTerm }); }

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