Skip to main content
Glama
bh-rat

context-awesome

by bh-rat

Find Awesome List Section

find_awesome_section

Discover relevant categories across awesome lists by searching for specific topics. This tool helps identify appropriate sections before retrieving curated resources from community-maintained lists.

Instructions

Discovers sections/categories across awesome lists matching a search query and returns matching sections from awesome lists.

You MUST call this function before 'get_awesome_items' to discover available sections UNLESS the user explicitly provides a githubRepo or listId.

Selection Process:

  1. Analyze the query to understand what type of resources the user is looking for

  2. Return the most relevant matches based on:

    • Name similarity to the query and the awesome lists section

    • Category/section relevance of the awesome lists

    • Number of items in the section

    • Confidence score

Response Format:

  • Returns matching sections of the awesome lists with metadata

  • Includes repository information, item counts, and confidence score

  • Use the githubRepo or listId with relevant sections from results for get_awesome_items

For ambiguous queries, multiple relevant sections will be returned for the user to choose from.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch terms for finding sections across awesome lists
confidenceNoMinimum confidence score (0-1)
limitNoMaximum sections to return

Implementation Reference

  • src/index.ts:122-239 (registration)
    Registration of the 'find_awesome_section' MCP tool, including schema definition and handler function.
      server.registerTool(
        "find_awesome_section",
        {
          title: "Find Awesome List Section",
          description: `Discovers sections/categories across awesome lists matching a search query and returns matching sections from awesome lists.
    
    You MUST call this function before 'get_awesome_items' to discover available sections UNLESS the user explicitly provides a githubRepo or listId.
    
    Selection Process:
    1. Analyze the query to understand what type of resources the user is looking for
    2. Return the most relevant matches based on:
       - Name similarity to the query and the awesome lists section
       - Category/section relevance of the awesome lists 
       - Number of items in the section
       - Confidence score
    
    Response Format:
    - Returns matching sections of the awesome lists with metadata
    - Includes repository information, item counts, and confidence score
    - Use the githubRepo or listId with relevant sections from results for get_awesome_items
    
    For ambiguous queries, multiple relevant sections will be returned for the user to choose from.`,
          inputSchema: {
            query: z
              .string()
              .describe("Search terms for finding sections across awesome lists"),
            confidence: z
              .number()
              .min(0)
              .max(1)
              .optional()
              .default(0.3)
              .describe("Minimum confidence score (0-1)"),
            limit: z
              .number()
              .min(1)
              .max(50)
              .optional()
              .default(10)
              .describe("Maximum sections to return"),
          },
        },
        async ({ query, confidence = 0.3, limit = 10 }) => {
          try {
            const response = await apiClient.findSections({ query, confidence, limit });
            
            if (!response.sections || response.sections.length === 0) {
              return {
                content: [
                  {
                    type: "text",
                    text: `No sections found matching "${query}". Try different search terms or browse available lists.`,
                  },
                ],
              };
            }
    
            const formattedSections = response.sections
              .map(
                (section) => {
                  const githubUrl = `https://github.com/${section.githubRepo}`;
                  const sectionPath = section.category.toLowerCase().replace(/\s+/g, '-');
                  const sectionUrl = `${githubUrl}#${sectionPath}`;
                  
                  return `### ${section.listName} - ${section.category}${
                    section.subcategory ? ` > ${section.subcategory}` : ''
                  }
    
    - **Repository**: \`${section.githubRepo}\`
    - **GitHub URL**: ${githubUrl}
    - **Section URL**: ${sectionUrl}
    - **Items**: ${section.itemCount}
    - **Confidence**: ${(section.confidence * 100).toFixed(1)}%
    - **Description**: ${
                    section.description || 
                    `A curated collection of ${section.itemCount} ${section.category.toLowerCase()} resources from ${section.listName}`
                  }`;
                }
              )
              .join('\n\n');
    
            return {
              content: [
                {
                  type: "text",
                  text: `# Search Results for "${query}"
    
    Found ${response.sections.length} relevant sections across awesome lists.
    
    ${formattedSections}
    
    ---
    
    ## How to retrieve items
    
    To get detailed items from any section above, use the \`get_awesome_items\` tool with:
    - **githubRepo**: The repository path (e.g., \`"${response.sections[0]?.githubRepo || 'repo/name'}"\`)
    - **section** (optional): The category name to filter results (e.g., \`"${response.sections[0]?.category || 'Section Name'}"\`)
    - **tokens** (optional): Maximum tokens to return (default: 10000)
    - **offset** (optional): For pagination (default: 0)
    
    Higher confidence scores indicate better matches for your search query.`,
                },
              ],
            };
          } catch (error: any) {
            const apiError = error as APIError;
            return {
              content: [
                {
                  type: "text",
                  text: apiError.message || "Failed to search for sections. Please try again.",
                },
              ],
            };
          }
        }
      );
  • The main handler function that executes the tool logic: calls the API client, formats results into markdown, handles errors.
        async ({ query, confidence = 0.3, limit = 10 }) => {
          try {
            const response = await apiClient.findSections({ query, confidence, limit });
            
            if (!response.sections || response.sections.length === 0) {
              return {
                content: [
                  {
                    type: "text",
                    text: `No sections found matching "${query}". Try different search terms or browse available lists.`,
                  },
                ],
              };
            }
    
            const formattedSections = response.sections
              .map(
                (section) => {
                  const githubUrl = `https://github.com/${section.githubRepo}`;
                  const sectionPath = section.category.toLowerCase().replace(/\s+/g, '-');
                  const sectionUrl = `${githubUrl}#${sectionPath}`;
                  
                  return `### ${section.listName} - ${section.category}${
                    section.subcategory ? ` > ${section.subcategory}` : ''
                  }
    
    - **Repository**: \`${section.githubRepo}\`
    - **GitHub URL**: ${githubUrl}
    - **Section URL**: ${sectionUrl}
    - **Items**: ${section.itemCount}
    - **Confidence**: ${(section.confidence * 100).toFixed(1)}%
    - **Description**: ${
                    section.description || 
                    `A curated collection of ${section.itemCount} ${section.category.toLowerCase()} resources from ${section.listName}`
                  }`;
                }
              )
              .join('\n\n');
    
            return {
              content: [
                {
                  type: "text",
                  text: `# Search Results for "${query}"
    
    Found ${response.sections.length} relevant sections across awesome lists.
    
    ${formattedSections}
    
    ---
    
    ## How to retrieve items
    
    To get detailed items from any section above, use the \`get_awesome_items\` tool with:
    - **githubRepo**: The repository path (e.g., \`"${response.sections[0]?.githubRepo || 'repo/name'}"\`)
    - **section** (optional): The category name to filter results (e.g., \`"${response.sections[0]?.category || 'Section Name'}"\`)
    - **tokens** (optional): Maximum tokens to return (default: 10000)
    - **offset** (optional): For pagination (default: 0)
    
    Higher confidence scores indicate better matches for your search query.`,
                },
              ],
            };
          } catch (error: any) {
            const apiError = error as APIError;
            return {
              content: [
                {
                  type: "text",
                  text: apiError.message || "Failed to search for sections. Please try again.",
                },
              ],
            };
          }
        }
      );
  • Zod input schema validation for the tool parameters.
    inputSchema: {
      query: z
        .string()
        .describe("Search terms for finding sections across awesome lists"),
      confidence: z
        .number()
        .min(0)
        .max(1)
        .optional()
        .default(0.3)
        .describe("Minimum confidence score (0-1)"),
      limit: z
        .number()
        .min(1)
        .max(50)
        .optional()
        .default(10)
        .describe("Maximum sections to return"),
    },
  • TypeScript interfaces defining input parameters, section data, and response structure for find_awesome_section.
    #!/usr/bin/env node
    
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
    import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
    import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
    import { z } from "zod";
    import { createServer } from "http";
    import { Command } from "commander";
    import { IncomingMessage } from "http";
    import { AwesomeContextAPIClient } from "./api-client.js";
    import { APIError } from "./types.js";
    
    const DEFAULT_MINIMUM_TOKENS = 10000;
    
    // Parse CLI arguments using commander
    const program = new Command()
      .option("--transport <stdio|http>", "transport type", "stdio")
      .option("--port <number>", "port for HTTP transport", "3000")
      .option("--api-host <url>", "Backend API host URL", process.env.AWESOME_CONTEXT_API_HOST || "https://api.context-awesome.com")
      .option("--api-key <key>", "API key for authentication")
      .option("--debug", "Enable debug logging")
  • API client method that performs the actual backend API call for finding sections.
    async findSections(params: FindSectionParams): Promise<FindSectionResponse> {
      this.log('Finding sections with params:', params);
      
      const response = await this.request<any>('/api/find-section', {
        query: params.query,  // Changed from 'q' to 'query'
        confidence: params.confidence,
        limit: params.limit,
      });
    
      // Handle both 'results' and 'sections' response formats
      const sections = response.results || response.sections || [];
      
      return {
        sections: sections.map((section: any) => ({
          id: section.id || section._id || '',
          listId: section.listId || '',
          listName: section.listName || section.list_name || '',
          githubRepo: section.githubRepo || section.github_repo || '',
          category: section.category || section.section || '',
          subcategory: section.subcategory || section.sub_category || '',
          itemCount: section.itemCount || section.item_count || 0,
          confidence: section.confidence || section.score || 0,
          description: section.description || '',
        })),
        total: response.total || sections.length,
      };
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: the selection process (4 criteria), response format (metadata included), and handling of ambiguous queries (returns multiple sections). It doesn't mention rate limits, authentication needs, or error conditions, but provides substantial operational context.

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

Conciseness4/5

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

The description is well-structured with clear sections: purpose statement, usage requirement, selection process, response format, and handling of ambiguous queries. While comprehensive, some sentences could be more concise (e.g., the selection process could be bulleted more efficiently). Overall, it's appropriately sized for the tool's complexity.

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

Completeness4/5

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

Given no annotations and no output schema, the description provides substantial context: purpose, usage rules, selection algorithm, response format, and relationship to sibling tool. It doesn't explicitly describe the exact structure of returned metadata or error cases, but covers most essential aspects for a search/discovery tool.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. The baseline of 3 is appropriate when the schema does the heavy lifting for parameter documentation.

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

Purpose5/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: 'Discovers sections/categories across awesome lists matching a search query and returns matching sections from awesome lists.' It specifies the verb ('discovers'), resource ('sections/categories across awesome lists'), and distinguishes it from its sibling 'get_awesome_items' by explaining this tool is for discovering sections before retrieving items.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance: 'You MUST call this function before 'get_awesome_items' to discover available sections UNLESS the user explicitly provides a githubRepo or listId.' It clearly states when to use this tool versus its sibling and includes conditions for when it's not needed.

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/bh-rat/context-awesome'

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