get_photo
Retrieve official portrait photographs of Dutch Members of Parliament for use in reports, presentations, or profiles. Input the MP's unique ID to receive the image as a binary resource.
Instructions
Retrieves the official portrait photograph of a Member of Parliament. Returns the image as a binary resource that can be displayed or saved. Use this when you need to include a visual representation of an MP in reports, presentations, or profiles.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"personId": "<personId>"
},
"name": "get_photo"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| personId | Yes | MP's numeric ID - the unique identifier for the Member of Parliament whose photo you want to retrieve |
Implementation Reference
- src/index.ts:318-347 (handler)The complete handler and registration for the 'get_photo' MCP tool. Fetches the MP's portrait image as binary data from the API endpoint `/personphoto/{personId}`, encodes it to base64, and returns it as an image/jpeg resource. Includes input schema validation with Zod and error handling.
mcp.tool( "get_photo", "Retrieves the official portrait photograph of a Member of Parliament. Returns the image as a binary resource that can be displayed or saved. Use this when you need to include a visual representation of an MP in reports, presentations, or profiles.", { personId: z.string().describe("MP's numeric ID - the unique identifier for the Member of Parliament whose photo you want to retrieve") }, async ({ personId }) => { try { const { data } = await apiService.fetchBinary(`/personphoto/${encodeURIComponent(personId)}`); const base64 = Buffer.from(data).toString("base64"); return { content: [ { type: "resource", resource: { uri: `photo://${personId}`, blob: base64, mimeType: "image/jpeg" } } ] }; } catch (error: any) { return { content: [{ type: "text", text: `Error fetching MP photo: ${error.message || 'Unknown error'}` }] }; } } );