Skip to main content
Glama

update_report

Modify existing penetration testing reports by editing fields like title, scope, findings, and status while maintaining secure HTML formatting standards.

Instructions

Update a report. HTML fields (goal, scope, summary description/keyFindings, recommendations) use minimal HTML formatting: only tags for paragraphs and for simple bullet lists. NO nesting, NO numbered lists, NO code blocks, NO headers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bearerTokenNoBearer token for authentication (optional if REPORTS_JWT_TOKEN env var is set)
reportIdYesThe ID of the report to update (24-character MongoDB ObjectId)
titleNoReport title (optional, max 100 characters)
platformNoPlatform name (optional)
goalNoHTML-formatted goal/objective using only <p> and <ul><li> tags (optional)
scopeNoHTML-formatted scope using only <p> and <ul><li> tags (optional)
summaryDescriptionNoHTML-formatted summary description using only <p> and <ul><li> tags (optional)
summaryKeyFindingsNoHTML-formatted key findings using only <p> and <ul><li> tags (optional)
recommendationsNoHTML-formatted recommendations using only <p> and <ul><li> tags (optional)
statusNoReport status (optional)

Implementation Reference

  • Core handler function that validates inputs, calls the API to update the report via PUT request, and returns formatted response or error.
    async function updateReport(providedToken, reportId, reportData) { try { const bearerToken = getBearerToken(providedToken); // Validate reportId format (should be MongoDB ObjectId) if (!reportId || !reportId.match(/^[0-9a-fA-F]{24}$/)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid reportId format. Must be a valid MongoDB ObjectId (24 characters)' ); } // Validate status if provided if (reportData.status !== undefined) { const validStatuses = ['Draft', 'In Progress', 'Submitted', 'Reviewed', 'Closed']; if (!validStatuses.includes(reportData.status)) { throw new McpError( ErrorCode.InvalidParams, `Status must be one of: ${validStatuses.join(', ')}` ); } } const response = await axios.put(`${REPORTS_ENDPOINT}/${reportId}`, reportData, { headers: { 'Authorization': `Bearer ${bearerToken}`, 'Content-Type': 'application/json', }, timeout: 15000, }); return { content: [ { type: 'text', text: JSON.stringify({ success: true, status: response.status, data: response.data, timestamp: new Date().toISOString(), message: `Successfully updated report ${reportId}`, }, null, 2), }, ], }; } catch (error) { if (error instanceof McpError) { throw error; } if (error.response) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, status: error.response.status, error: error.response.data || error.message, timestamp: new Date().toISOString(), }, null, 2), }, ], }; } else if (error.request) { throw new McpError( ErrorCode.InternalError, `Network error: Unable to reach the API at ${REPORTS_ENDPOINT}/${reportId}` ); } else { throw new McpError( ErrorCode.InternalError, `Request setup error: ${error.message}` ); } } }
  • JSON schema defining the input parameters for the update_report tool, including validation for required reportId and optional fields like title, status, etc.
    type: 'object', properties: { bearerToken: { type: 'string', description: 'Bearer token for authentication (optional if REPORTS_JWT_TOKEN env var is set)', }, reportId: { type: 'string', description: 'The ID of the report to update (24-character MongoDB ObjectId)', }, title: { type: 'string', description: 'Report title (optional, max 100 characters)', }, platform: { type: 'string', description: 'Platform name (optional)', }, goal: { type: 'string', description: 'HTML-formatted goal/objective using only <p> and <ul><li> tags (optional)', }, scope: { type: 'string', description: 'HTML-formatted scope using only <p> and <ul><li> tags (optional)', }, summaryDescription: { type: 'string', description: 'HTML-formatted summary description using only <p> and <ul><li> tags (optional)', }, summaryKeyFindings: { type: 'string', description: 'HTML-formatted key findings using only <p> and <ul><li> tags (optional)', }, recommendations: { type: 'string', description: 'HTML-formatted recommendations using only <p> and <ul><li> tags (optional)', }, status: { type: 'string', enum: ['Draft', 'In Progress', 'Submitted', 'Reviewed', 'Closed'], description: 'Report status (optional)', }, }, required: ['reportId'], },
  • server.js:782-832 (registration)
    Registration of the update_report tool in the ListTools response, including name, description, and input schema.
    { name: 'update_report', description: 'Update a report. HTML fields (goal, scope, summary description/keyFindings, recommendations) use minimal HTML formatting: only <p> tags for paragraphs and <ul><li> for simple bullet lists. NO nesting, NO numbered lists, NO code blocks, NO headers.', inputSchema: { type: 'object', properties: { bearerToken: { type: 'string', description: 'Bearer token for authentication (optional if REPORTS_JWT_TOKEN env var is set)', }, reportId: { type: 'string', description: 'The ID of the report to update (24-character MongoDB ObjectId)', }, title: { type: 'string', description: 'Report title (optional, max 100 characters)', }, platform: { type: 'string', description: 'Platform name (optional)', }, goal: { type: 'string', description: 'HTML-formatted goal/objective using only <p> and <ul><li> tags (optional)', }, scope: { type: 'string', description: 'HTML-formatted scope using only <p> and <ul><li> tags (optional)', }, summaryDescription: { type: 'string', description: 'HTML-formatted summary description using only <p> and <ul><li> tags (optional)', }, summaryKeyFindings: { type: 'string', description: 'HTML-formatted key findings using only <p> and <ul><li> tags (optional)', }, recommendations: { type: 'string', description: 'HTML-formatted recommendations using only <p> and <ul><li> tags (optional)', }, status: { type: 'string', enum: ['Draft', 'In Progress', 'Submitted', 'Reviewed', 'Closed'], description: 'Report status (optional)', }, }, required: ['reportId'], }, },
  • Helper function to retrieve or fallback to environment JWT token for authentication, used in updateReport.
    function getBearerToken(providedToken) { // If a token is provided in the request, use it if (providedToken) { return providedToken; } // Otherwise, use the configured JWT token if (JWT_TOKEN) { return JWT_TOKEN; } // If no token is available, throw an error throw new McpError( ErrorCode.InvalidParams, 'No bearer token provided. Either pass bearerToken parameter or set REPORTS_JWT_TOKEN environment variable.' ); }
  • Dispatch handler in CallToolRequestHandler that preprocesses arguments (formats HTML fields), validates, and calls the updateReport function.
    case 'update_report': if (!args.reportId) { throw new McpError( ErrorCode.InvalidParams, 'Report ID is required' ); } // Build update data object from provided fields with auto-HTML formatting for HTML fields const reportUpdateData = {}; if (args.title !== undefined) reportUpdateData.title = args.title; if (args.platform !== undefined) reportUpdateData.platform = args.platform; if (args.goal !== undefined) reportUpdateData.goal = formatAsHTML(args.goal); if (args.scope !== undefined) reportUpdateData.scope = formatAsHTML(args.scope); if (args.recommendations !== undefined) reportUpdateData.recommendations = formatAsHTML(args.recommendations, 'list'); if (args.status !== undefined) reportUpdateData.status = args.status; // Handle summary object fields if (args.summaryDescription !== undefined || args.summaryKeyFindings !== undefined) { reportUpdateData.summary = {}; if (args.summaryDescription !== undefined) { reportUpdateData.summary.description = formatAsHTML(args.summaryDescription); } if (args.summaryKeyFindings !== undefined) { reportUpdateData.summary.keyFindings = formatAsHTML(args.summaryKeyFindings, 'list'); } } if (Object.keys(reportUpdateData).length === 0) { throw new McpError( ErrorCode.InvalidParams, 'At least one field must be provided to update' ); } return await updateReport(args.bearerToken, args.reportId, reportUpdateData);

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

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