natural_language_query
Analyze GitHub data instantly by submitting natural language queries to extract insights on repositories, developers, and open source ecosystems.
Instructions
Query GitHub data using natural language through the OSSInsight chat interface
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural language query, e.g., 'Which repositories gained the most stars in 2023?' |
Implementation Reference
- index.ts:271-281 (handler)The core handler function for the 'natural_language_query' tool. It takes a natural language query string and returns a structured response with a message and a direct link to the OSSInsight web chat interface for executing the query.async function naturalLanguageQuery(query: string): Promise<any> { // Natural language query is likely not available via the public API // So we'll direct users to the web interface const webUrl = `${OSSINSIGHT_WEB_URL}/chat?question=${encodeURIComponent(query)}`; return { message: "Natural language queries are best handled through the OSSInsight web interface.", web_url: webUrl }; }
- schemas.ts:23-25 (schema)Zod schema defining the input parameters for the 'natural_language_query' tool: requires a 'query' field as a string with a descriptive example.export const NaturalLanguageQueryParamsSchema = z.object({ query: z.string().describe("Natural language query, e.g., 'Which repositories gained the most stars in 2023?'") });
- index.ts:307-311 (registration)Registration of the tool in the ListToolsRequest handler response, specifying name, description, and input schema converted to JSON schema format.{ name: "natural_language_query", description: "Query GitHub data using natural language through the OSSInsight chat interface", inputSchema: zodToJsonSchema(NaturalLanguageQueryParamsSchema) }
- index.ts:348-352 (registration)Dispatch handler in the CallToolRequest switch statement: parses input arguments using the schema, calls the naturalLanguageQuery handler, and formats the response as MCP content.case "natural_language_query": { const args = NaturalLanguageQueryParamsSchema.parse(request.params.arguments); const result = await naturalLanguageQuery(args.query); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }