Skip to main content
Glama

search_threads

Find course discussion threads by searching titles, content, or categories to locate relevant academic conversations and resources.

Instructions

Search threads in a course by title, content, or category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYesCourse ID
queryYesSearch query (matches title, content, and category)
categoryNoFilter by category name (exact match)
limitNoMax threads to fetch before filtering

Implementation Reference

  • The `search_threads` tool is registered and implemented in `src/index.ts`. It fetches threads using `api.listThreads` and then filters them client-side based on the title, category, subcategory, and content.
    server.tool(
      "search_threads",
      "Search threads in a course by title, content, or category",
      {
        course_id: z.number().describe("Course ID"),
        query: z.string().describe("Search query (matches title, content, and category)"),
        category: z.string().optional().describe("Filter by category name (exact match)"),
        limit: z.number().min(1).max(100).default(50).describe("Max threads to fetch before filtering"),
      },
      async ({ course_id, query, category, limit }) => {
        try {
          const threads = await api.listThreads(course_id, { limit, sort: "new" });
          const q = query.toLowerCase();
          const matches = threads.filter((t) => {
            if (category && t.category.toLowerCase() !== category.toLowerCase()) {
              return false;
            }
            return (
              t.title.toLowerCase().includes(q) ||
              t.category.toLowerCase().includes(q) ||
              t.subcategory.toLowerCase().includes(q) ||
              edXmlToPlainText(t.document ?? "").toLowerCase().includes(q)
            );
          });
          const summary = matches.map((t) => ({
            id: t.id,
            number: t.number,
            type: t.type,
            title: t.title,
            category: t.category,
            subcategory: t.subcategory,
            reply_count: t.reply_count,
            is_answered: t.is_answered,
            created_at: t.created_at,
          }));
          return ok(summary);
        } catch (err) {
          return fail(err);
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but discloses minimal behavioral details. It doesn't specify if the search is case-sensitive, fuzzy vs exact matching (beyond the category parameter schema), result ordering, or what the return payload contains.

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?

Single, efficient sentence of nine words. Information is front-loaded and immediately actionable with no redundancy or filler content.

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

Completeness3/5

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

Given the comprehensive input schema (100% coverage) and absence of an output schema, the description provides the minimum viable context for a search operation. However, it omits expected details about result structure or pagination behavior that would be necessary given the 'limit' parameter implies result set management.

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?

Input schema has 100% description coverage, establishing a baseline of 3. The description aggregates the parameter purposes ('by title, content, or category') but adds no additional semantic context such as query syntax, wildcard support, or examples that the schema doesn't already provide.

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?

States the specific action (Search), resource (threads), and scope (in a course). Mentions searchable fields (title, content, category) which distinguishes it from generic retrieval tools like get_thread or list_threads, though it doesn't explicitly clarify when to choose this over list_threads.

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?

Provides no guidance on when to use this tool versus alternatives like list_threads or get_course_thread. Does not mention prerequisites (e.g., user permissions) or when search is preferable to direct retrieval.

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/rob-9/edstem-mcp'

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