misp_list_organisations
List MISP organisations, including local and remote sharing partners. Filter by scope: local, external, or all.
Instructions
List MISP organisations (local and remote sharing partners)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | No | Filter by local, external, or all organisations |
Implementation Reference
- src/tools/organisations.ts:10-55 (handler)The tool handler for 'misp_list_organisations'. Registers a server.tool with an optional 'scope' parameter (local/external/all), calls client.listOrganisations(), and returns a formatted JSON summary of organisations.
server.tool( "misp_list_organisations", "List MISP organisations (local and remote sharing partners)", { scope: z .enum(["local", "external", "all"]) .optional() .describe("Filter by local, external, or all organisations"), }, async ({ scope }) => { try { const orgs = await client.listOrganisations(scope || "all"); if (orgs.length === 0) { return { content: [{ type: "text", text: "No organisations found." }], }; } const summary = orgs.map((o) => ({ id: o.id, name: o.name, uuid: o.uuid, description: o.description, nationality: o.nationality, sector: o.sector, type: o.type, local: o.local, })); return { content: [{ type: "text", text: JSON.stringify(summary, null, 2) }], }; } catch (err) { return { content: [ { type: "text", text: `Error listing organisations: ${err instanceof Error ? err.message : String(err)}`, }, ], isError: true, }; } } ); - src/tools/organisations.ts:13-18 (schema)Input schema for the tool defines an optional 'scope' parameter using zod enum with values 'local', 'external', or 'all'.
{ scope: z .enum(["local", "external", "all"]) .optional() .describe("Filter by local, external, or all organisations"), }, - src/tools/organisations.ts:5-83 (registration)Registration function that registers the 'misp_list_organisations' (and 'misp_get_organisation') tools on the MCP server. Called from src/index.ts line 41.
export function registerOrganisationTools( server: McpServer, client: MispClient ): void { // List organisations server.tool( "misp_list_organisations", "List MISP organisations (local and remote sharing partners)", { scope: z .enum(["local", "external", "all"]) .optional() .describe("Filter by local, external, or all organisations"), }, async ({ scope }) => { try { const orgs = await client.listOrganisations(scope || "all"); if (orgs.length === 0) { return { content: [{ type: "text", text: "No organisations found." }], }; } const summary = orgs.map((o) => ({ id: o.id, name: o.name, uuid: o.uuid, description: o.description, nationality: o.nationality, sector: o.sector, type: o.type, local: o.local, })); return { content: [{ type: "text", text: JSON.stringify(summary, null, 2) }], }; } catch (err) { return { content: [ { type: "text", text: `Error listing organisations: ${err instanceof Error ? err.message : String(err)}`, }, ], isError: true, }; } } ); // Get organisation details server.tool( "misp_get_organisation", "Get details of a specific MISP organisation", { orgId: z.string().describe("Organisation ID"), }, async ({ orgId }) => { try { const org = await client.getOrganisation(orgId); return { content: [{ type: "text", text: JSON.stringify(org, null, 2) }], }; } catch (err) { return { content: [ { type: "text", text: `Error getting organisation: ${err instanceof Error ? err.message : String(err)}`, }, ], isError: true, }; } } ); } - src/index.ts:41-42 (registration)Top-level registration call that invokes registerOrganisationTools to register the tool on the MCP server.
registerOrganisationTools(server, client); registerServerTools(server, client); - src/client.ts:633-641 (helper)Helper method on MispClient that makes the HTTP GET request to /organisations/index/scope:{scope} and maps the response to MispOrganisation[].
async listOrganisations( scope: "local" | "external" | "all" = "all" ): Promise<MispOrganisation[]> { // scope is constrained by the TS type above const data = await this.request< Array<{ Organisation: MispOrganisation }> >("GET", `/organisations/index/scope:${scope}`); return (data || []).map((o) => o.Organisation); }