link preview v1
This commit is contained in:
+12
-1
@@ -34,6 +34,7 @@ from projects import services
|
||||
from projects.models import Activity, Card, CardComment, CardRevision, CardAttachment, Column, Project, Tag, ProjectDocument, DocumentationSync
|
||||
from projects import attachments
|
||||
from projects import documentation
|
||||
from knowledge import services as knowledge_services
|
||||
|
||||
|
||||
def _verified(raw):
|
||||
@@ -150,11 +151,21 @@ def _safe(operation):
|
||||
|
||||
|
||||
def create_server():
|
||||
server = MCPServer('Common Ground Projects', description='Projects, Kanban cards, and Markdown specifications.',
|
||||
server = MCPServer('Common Ground', description='Projects and a separate personal knowledge library.',
|
||||
token_verifier=OAuthTokenVerifier(), auth=AuthSettings(
|
||||
issuer_url=AnyHttpUrl(settings.OAUTH_ISSUER_URL),
|
||||
resource_server_url=AnyHttpUrl(settings.MCP_PUBLIC_URL), required_scopes=[], validate_token_resource=False))
|
||||
|
||||
@server.tool(structured_output=True, description='Find up to three relevant links in the connected user’s private Knowledge Library when the conversation overlaps their saved interests. Call opportunistically for concrete topics; an empty result means do not interrupt the user. This tool cannot observe conversations unless called by the client.')
|
||||
async def find_relevant_saved_interests(context: str) -> dict[str, Any]:
|
||||
def run():
|
||||
user = _actor('knowledge:read')
|
||||
matches = knowledge_services.relevant_items(user, context[:2000])
|
||||
return {'items': [{'id': str(item.pk), 'title': item.title or item.extracted_title or item.original_url,
|
||||
'url': item.original_url, 'saved_reason': item.saved_reason,
|
||||
'why_relevant': 'Matches ' + ', '.join(hits)} for _, item, hits in matches]}
|
||||
return await sync_to_async(lambda: _safe(run))()
|
||||
|
||||
@server.tool(structured_output=True, description='List projects accessible to the connected user, with counts and repository metadata.')
|
||||
async def projects_list(limit: int = 50, offset: int = 0) -> dict[str, Any]:
|
||||
def run():
|
||||
|
||||
Reference in New Issue
Block a user