Skip to main content
Glama

get-prerequisites

Retrieve security assessment prerequisites for a specific round to identify requirements that must be completed before testing begins.

Instructions

Get all prerequisites data from OnSecurity for a specific round. Prerequisites are requirements that need to be fulfilled before a security assessment can begin.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
round_idYesRequired round ID to filter prerequisites
sortNoOptional sort parameter in format 'field-direction'. Available values: name-asc, name-desc, created_at-asc, created_at-desc, updated_at-asc, updated_at-desc. Default: id-asc
limitNoOptional limit parameter for max results per page (e.g. 15)
pageNoOptional page number to fetch (default: 1)
fieldsNoOptional comma-separated list of fields to return (e.g. 'id,name,status'). Use * as wildcard.
filtersNoOptional additional filters in format {field: value} or {field-operator: value} where operator can be mt (more than), mte (more than equal), lt (less than), lte (less than equal), eq (equals, default)

Implementation Reference

  • The handler function for the 'get-prerequisites' tool. It constructs filters with the required round_id, fetches data using fetchPage helper from the 'prerequisites' API endpoint, formats the results using formatPrerequisite and formatPaginationInfo, and returns a markdown-formatted text response.
    async (params) => { const filters: Record<string, string | number> = { 'round_id-eq': params.round_id }; // Add additional filters if provided if (params.filters) { Object.entries(params.filters).forEach(([key, value]) => { filters[key] = value; }); } const response = await fetchPage<ApiResponse<PrerequisiteFeature>>( 'prerequisites', params.page || 1, filters, params.sort, undefined, // includes not mentioned in the docs params.fields, params.limit ); if (!response) { return { content: [ { type: "text", text: "Error fetching prerequisites data. Please try again." } ] }; } const paginationInfo = formatPaginationInfo(response); const formattedPrerequisites = response.result.map(formatPrerequisite); const responseText = [ "# Prerequisites Summary", "", "## Pagination Information", paginationInfo, "", "## Prerequisites Data", ...formattedPrerequisites ].join('\n'); return { content: [ { type: "text", text: responseText } ] }; }
  • Zod schema defining the input parameters for the 'get-prerequisites' tool, including required round_id and optional pagination, sorting, and filtering options.
    round_id: z.number().describe("Required round ID to filter prerequisites"), sort: z.string().optional().describe("Optional sort parameter in format 'field-direction'. Available values: name-asc, name-desc, created_at-asc, created_at-desc, updated_at-asc, updated_at-desc. Default: id-asc"), limit: z.number().optional().describe("Optional limit parameter for max results per page (e.g. 15)"), page: z.number().optional().describe("Optional page number to fetch (default: 1)"), fields: z.string().optional().describe("Optional comma-separated list of fields to return (e.g. 'id,name,status'). Use * as wildcard."), filters: FilterSchema, },
  • src/index.ts:589-655 (registration)
    The registration of the 'get-prerequisites' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool( "get-prerequisites", "Get all prerequisites data from OnSecurity for a specific round. Prerequisites are requirements that need to be fulfilled before a security assessment can begin.", { round_id: z.number().describe("Required round ID to filter prerequisites"), sort: z.string().optional().describe("Optional sort parameter in format 'field-direction'. Available values: name-asc, name-desc, created_at-asc, created_at-desc, updated_at-asc, updated_at-desc. Default: id-asc"), limit: z.number().optional().describe("Optional limit parameter for max results per page (e.g. 15)"), page: z.number().optional().describe("Optional page number to fetch (default: 1)"), fields: z.string().optional().describe("Optional comma-separated list of fields to return (e.g. 'id,name,status'). Use * as wildcard."), filters: FilterSchema, }, async (params) => { const filters: Record<string, string | number> = { 'round_id-eq': params.round_id }; // Add additional filters if provided if (params.filters) { Object.entries(params.filters).forEach(([key, value]) => { filters[key] = value; }); } const response = await fetchPage<ApiResponse<PrerequisiteFeature>>( 'prerequisites', params.page || 1, filters, params.sort, undefined, // includes not mentioned in the docs params.fields, params.limit ); if (!response) { return { content: [ { type: "text", text: "Error fetching prerequisites data. Please try again." } ] }; } const paginationInfo = formatPaginationInfo(response); const formattedPrerequisites = response.result.map(formatPrerequisite); const responseText = [ "# Prerequisites Summary", "", "## Pagination Information", paginationInfo, "", "## Prerequisites Data", ...formattedPrerequisites ].join('\n'); return { content: [ { type: "text", text: responseText } ] }; } );
  • Helper function to format a single PrerequisiteFeature object into a human-readable string used in the tool's response.
    function formatPrerequisite(prerequisite: PrerequisiteFeature): string { return [ `Prerequisite ID: ${prerequisite.id}`, `Round ID: ${prerequisite.round_id}`, `Name: ${prerequisite.name || "N/A"}`, `Description: ${prerequisite.description || "N/A"}`, `Required: ${prerequisite.required !== undefined ? prerequisite.required : "N/A"}`, `Status: ${prerequisite.status || "N/A"}`, `Created At: ${prerequisite.created_at || "N/A"}`, `Updated At: ${prerequisite.updated_at || "N/A"}`, `--------------------------------`, ].join('\n');
  • TypeScript interface defining the structure of a PrerequisiteFeature from the OnSecurity API, used in typing the API response.
    export interface PrerequisiteFeature { id: number; round_id: number; name?: string; description?: string; required?: boolean; status?: string; created_at?: string; updated_at?: string; }

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/onsecurity/onsecurity-mcp-server'

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