Skip to main content
Glama
glaucia86
by glaucia86

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 });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It doesn't describe whether this is a read-only operation, how results are returned (format, pagination), performance characteristics, or error conditions. The description only states what the tool does at a high level without operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 5 words with zero wasted language. It's front-loaded with the core functionality and uses efficient phrasing. Every word serves a purpose in conveying the tool's basic function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with 3 parameters and no output schema, the description is inadequate. It doesn't explain what constitutes a match (exact, partial, case-sensitive), how multiple parameters interact, what the return format looks like, or any limitations. The description provides only the most basic functional statement without necessary operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions searching by title or description, which aligns with the 'searchTerm' parameter but doesn't add meaningful context beyond what the schema already provides. With 100% schema description coverage that includes clear parameter descriptions and enum values, the description adds minimal value. The baseline of 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as searching todos by title or description, which is a specific verb+resource combination. However, it doesn't distinguish this tool from the sibling 'list_todos' tool, which might offer different filtering capabilities or scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_todos' or 'get_todo'. There's no mention of prerequisites, performance considerations, or appropriate contexts for choosing this search functionality over other todo-related tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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