API-get-background-result
Retrieve processed Notion page results from background operations to access completed data without waiting.
Instructions
Retrieve the result of a background processing request
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": {
"page_id": "<page_id>"
},
"name": "API-get-background-result"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page_id | Yes | Identifier for the Notion page that was processed in background |
Implementation Reference
- src/openapi-mcp-server/mcp/proxy.ts:180-196 (registration)Registers the 'API-get-background-result' tool in the tools list provided to MCP, including description and input schema requiring 'page_id'.
const backgroundResultTool = { name: 'API-get-background-result', description: 'Retrieve the result of a background processing request', inputSchema: { type: 'object', properties: { page_id: { type: 'string', description: 'Identifier for the Notion page that was processed in background', }, }, required: ['page_id'], } as Tool['inputSchema'], }; tools.push(backgroundResultTool); console.log(`- ${backgroundResultTool.name}: ${backgroundResultTool.description}`); - Tool call handler within MCP's CallToolRequestHandler that invokes getBackgroundProcessingResult and returns the result as JSON text content.
// Handle background result retrieval if (name === 'API-get-background-result') { const result = this.getBackgroundProcessingResult(params?.page_id as string); return { content: [ { type: 'text', text: JSON.stringify(result), }, ], }; } - Executes the core logic of the tool by fetching the stored background result from the in-memory Map or returning a not_found message.
public getBackgroundProcessingResult(pageId: string): any { return this.backgroundProcessingResults.get(pageId) || { status: 'not_found', message: `No background processing result found for page ${pageId}` }; } - In-memory storage Map for background processing results, used by the tool handler.
private backgroundProcessingResults: Map<string, any> = new Map() - Helper method to store background processing results in the Map, called after background processing completes.
this.backgroundProcessingResults.set(pageId, result); }