Skip to main content
Glama

SouthAsia MCP Tool

server.cpython-310.pyc4.6 kB
o �V�g�� @s<UddlZddlmZddlmZddlmZmZddlm Z ddl Z iZ e eefed<ed�Ze��deejfdd ��Ze��d e defd d ��Ze��deejfd d��Ze��dede eefdBdejfdd��Ze��deejfdd��Ze� �dede dBdeej!ej"Bej#Bfdd��Z$dd�Z%dS)�N)�InitializationOptions)�NotificationOptions�Server)�AnyUrl�notes� southAsia�returnc�s�dd�tD�S)zq List available note resources. Each note is exposed as a resource with a custom note:// URI scheme. cSs4g|]}tjtd|���d|��d|��dd��qS)znote://internal/zNote: zA simple note named z text/plain)�uri�name� descriptionZmimeType)�types�Resourcer)�.0r �r�4D:\AI\MCP_SDK\tool\southAsia\src\southasia\server.py� <listcomp>s� ��z)handle_list_resources.<locals>.<listcomp>)rrrrr�handle_list_resourcess��rr c�sJ�|jdkrtd|j����|j}|dur|�d�}t|Std|����)zp Read a specific note's content by its URI. The note name is extracted from the URI host component. ZnotezUnsupported URI scheme: N�/zNote not found: )Zscheme� ValueError�path�lstripr)r r rrr�handle_read_resources�  rc�s"�tjddtjdddd�gd�gS)zh List available prompts. Each prompt can have optional arguments to customize its behavior. �summarize-noteszCreates a summary of all notes�stylez%Style of the summary (brief/detailed)F)r r �required)r r � arguments)r �PromptZPromptArgumentrrrr�handle_list_prompts-s�����rr rc �s|�|dkr td|����|pi�dd�}|dkrdnd}tjdtjd tjd d |�d �d �dd�t��D��d�d�gd�S)z� Generate a prompt by combining arguments with server state. The prompt includes all current notes and can be customized via arguments. rzUnknown prompt: rZbriefZdetailedz Give extensive details.�zSummarize the current notes�user�textz(Here are the current notes to summarize:z � css$�|] \}}d|�d|��VqdS)z- z: Nr)rr �contentrrr� <genexpr>Ws �� �z$handle_get_prompt.<locals>.<genexpr>��typer )Zroler")r Zmessages) r�getr �GetPromptResultZ PromptMessage� TextContent�joinr�items)r rrZ detail_promptrrr�handle_get_promptAs(�  ������r+c�s.�tjdddddiddid�ddgd �d �gS) zc List available tools. Each tool specifies its arguments using JSON Schema validation. �add-notezAdd a new note�objectr%�string)r r"r r")r%Z propertiesr)r r Z inputSchema)r �Toolrrrr�handle_list_tools`s�����r0c�s~�|dkr td|����|std��|�d�}|�d�}|r |s$td��|t|<tjj��IdHtjdd |�d |��d �gS) zj Handle tool execution requests. Tools can modify server state and notify clients of changes. r,zUnknown tool: zMissing argumentsr r"zMissing name or contentNr z Added note 'z' with content: r$) rr&r�serverZrequest_contextZsessionZsend_resource_list_changedr r()r rZ note_namer"rrr�handle_call_toolus �  ��r2c �sv�tjj��4IdH�#\}}t�||tddtjt�id�d��IdHWd�IdHdS1IdHs4wYdS)Nrz1.0)Znotification_optionsZexperimental_capabilities)Z server_nameZserver_versionZ capabilities)�mcpr1ZstdioZ stdio_server�runrZget_capabilitiesr)Z read_streamZ write_streamrrr�main�s��� �.�r5)&�asyncioZmcp.server.modelsrZ mcp.typesr Z mcp.serverrrZpydanticrZmcp.server.stdior3r�dict�str�__annotations__r1Zlist_resources�listr rZ read_resourcerZ list_promptsrrZ get_promptr'r+Z list_toolsr/r0Z call_toolr(Z ImageContentZEmbeddedResourcer2r5rrrr�<module>sB   �� ��� �

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/igs-pochenkuo/southasia_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server