get-user-info
Retrieve basic user information from NeoDB's social book cataloging service to access account details and personalize your reading experience.
Instructions
Get current user's basic info
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get-user-info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/neodb/server.py:13-57 (registration)Registration of all tools via @server.list_tools(), specifically including the get-user-info tool with its schema.
@server.list_tools() async def handle_list_tools() -> list[types.Tool]: """ List available tools. Each tool specifies its arguments using JSON Schema validation. """ return [ types.Tool( name="get-user-info", description="Get current user's basic info", inputSchema={ "type": "object", "properties": {}, # No parameters needed "required": [], }, ), types.Tool( name="search-books", description="Search items in catalog", inputSchema={ "type": "object", "properties": { "query": { "type": "string", "description": "Search query for books", } }, "required": ["query"], }, ), types.Tool( name="get-book", description="Get detailed information about a specific book", inputSchema={ "type": "object", "properties": { "book_id": { "type": "string", "description": "The ID of the book to retrieve", }, }, "required": ["book_id"], }, ), ] - src/neodb/server.py:20-28 (schema)Schema definition for get-user-info tool: no input parameters required.
types.Tool( name="get-user-info", description="Get current user's basic info", inputSchema={ "type": "object", "properties": {}, # No parameters needed "required": [], }, ), - src/neodb/server.py:116-154 (handler)Implementation of the get-user-info tool handler: calls NeoDB /api/me endpoint using access token, handles errors, and returns formatted user information.
if name == "get-user-info": """ https://neodb.social/developer/#/user/users_api_me """ async with httpx.AsyncClient() as client: user_data, status_code = await make_neodb_request( client, access_token, '/api/me', api_base ) if status_code != 200: error_message = { 401: "Unauthorized", }.get(status_code, f"Request failed with status code: {status_code}") return [types.TextContent(type="text", text=error_message)] if not user_data: return [types.TextContent(type="text", text="Failed to retrieve user information")] # Format user information user_text = ( f"User Information:\n" f"Username: {user_data.get('username', 'Unknown')}\n" f"Display Name: {user_data.get('display_name', 'Unknown')}\n" f"Email: {user_data.get('email', 'Not provided')}\n" f"URL: {user_data.get('url', 'Not provided')}\n" f"Account Created: {user_data.get('created_at', 'Unknown')}\n" ) return [ types.TextContent( type="text", text=user_text ) ]