get_document_content
Retrieve detailed patent document content with chemical annotations using a document ID to access SureChEMBL’s chemical patent database.
Instructions
Get complete patent document content with chemical annotations by document ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | Patent document ID (e.g., WO-2020096695-A1) |
Implementation Reference
- src/index.ts:628-649 (handler)The handler function that validates input, fetches patent document content from SureChEMBL API endpoint `/document/{document_id}/contents`, and returns it as JSON text content.private async handleGetDocumentContent(args: any) { if (!isValidDocumentArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid document arguments'); } try { const response = await this.apiClient.get(`/document/${args.document_id}/contents`); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to get document content: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
- src/index.ts:353-363 (registration)Tool registration in ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'get_document_content', description: 'Get complete patent document content with chemical annotations by document ID', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'Patent document ID (e.g., WO-2020096695-A1)' }, }, required: ['document_id'], }, },
- src/index.ts:356-362 (schema)Input schema definition for the get_document_content tool.inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'Patent document ID (e.g., WO-2020096695-A1)' }, }, required: ['document_id'], },
- src/index.ts:104-114 (helper)Validation helper function used in the handler to check input arguments.const isValidDocumentArgs = ( args: any ): args is { document_id: string; include_annotations?: boolean } => { return ( typeof args === 'object' && args !== null && typeof args.document_id === 'string' && args.document_id.length > 0 && (args.include_annotations === undefined || typeof args.include_annotations === 'boolean') ); };
- src/index.ts:546-547 (registration)Dispatch case in CallToolRequestSchema switch statement that routes to the handler.case 'get_document_content': return await this.handleGetDocumentContent(args);