misp_list_sharing_groups
List MISP sharing groups to control event distribution and manage access permissions.
Instructions
List MISP sharing groups for controlled event distribution
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/servers.ts:56-100 (handler)The MCP tool handler for 'misp_list_sharing_groups' - calls client.listSharingGroups() and formats the response as JSON text.
server.tool( "misp_list_sharing_groups", "List MISP sharing groups for controlled event distribution", {}, async () => { try { const groups = await client.listSharingGroups(); if (groups.length === 0) { return { content: [ { type: "text", text: "No sharing groups configured.", }, ], }; } const summary = groups.map((g) => ({ id: g.id, name: g.name, description: g.description, uuid: g.uuid, releasability: g.releasability, active: g.active, org_count: g.org_count, })); return { content: [{ type: "text", text: JSON.stringify(summary, null, 2) }], }; } catch (err) { return { content: [ { type: "text", text: `Error listing sharing groups: ${err instanceof Error ? err.message : String(err)}`, }, ], isError: true, }; } } ); - src/types.ts:120-128 (schema)TypeScript interface MispSharingGroup defining the shape of sharing group objects (id, name, description, uuid, releasability, active, org_count).
export interface MispSharingGroup { id: string; name: string; description: string; uuid: string; releasability: string; active: boolean; org_count: number; } - src/tools/servers.ts:55-100 (registration)Registration of the tool on the McpServer via server.tool() with name 'misp_list_sharing_groups', description, empty schema input, and async handler.
// List sharing groups server.tool( "misp_list_sharing_groups", "List MISP sharing groups for controlled event distribution", {}, async () => { try { const groups = await client.listSharingGroups(); if (groups.length === 0) { return { content: [ { type: "text", text: "No sharing groups configured.", }, ], }; } const summary = groups.map((g) => ({ id: g.id, name: g.name, description: g.description, uuid: g.uuid, releasability: g.releasability, active: g.active, org_count: g.org_count, })); return { content: [{ type: "text", text: JSON.stringify(summary, null, 2) }], }; } catch (err) { return { content: [ { type: "text", text: `Error listing sharing groups: ${err instanceof Error ? err.message : String(err)}`, }, ], isError: true, }; } } ); - src/client.ts:674-679 (helper)The client method listSharingGroups() that performs the GET request to /sharing_groups API endpoint and maps the response to MispSharingGroup[].
async listSharingGroups(): Promise<MispSharingGroup[]> { const data = await this.request<{ response: Array<{ SharingGroup: MispSharingGroup }>; }>("GET", "/sharing_groups"); return (data.response || []).map((g) => g.SharingGroup); }